The Shell MD5 the files in the entire folder [go]

Source: Internet
Author: User

  1. To view the MD5 command for a local file: Md5sum FileName
    To view the MD5 code for all files in the home directory:
    CD ~
    Find/home-type f-print0 | xargs-0 md5sum | Sort >md5.txt
    To view the MD5 code for all files in the current directory:
    Find./-type f-print0 | xargs-0 md5sum | Sort >md5.txt

  2. Generate a copy of the MD5 checksum file in the home folder using the above method
    This MD5 file can be used as a checksum file for this home folder, verifying that a folder data is the same as the home directory by generating a copy of the MD5 checksum file in the same way for that folder, and then verifying that the file is the same, if the two files are the same, This is considered to be the same as the two data folders

  3. When the number of servers is increased, the server can not be MD5 verified by the command
    The following shell script is a script-generated MD5 file.
    #!/bin/bash# author:jerry.huang# Set Environment Variableslang=""Export LANGEcho ""Echo ""Echo "Please put Check_file in the same directory?"Echo ""Read-P"Is you put the check_file in the right position? (y/n):"Select_ynEcho ""Echo ""if["$select _yn"=="Y"] || ["$select _yn"=="y"]; Then    Echo "start generate Data.md5 ..."CD./DataFind./-type F-print0 |Xargs-0md5sum |Sort>.. /DATA.MD5Echo "generate MD5 value over"elif["$select _yn"=="N"] || ["$select _yn"=="N"]; Then     Echo "stop generate MD5 value!"Else    Echo "I don ' t know what your choice is!!!"fi
    md5sum Code

The Shell MD5 the files in the entire folder [go]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.