create one md5 for all files in folder

tar c folderName | md5
Sample Output
a39ff7fb6f6c5850471cc92154954f88

-7
By: Whitefox
2015-05-15 13:08:33

These Might Interest You

  • If you have a folder with thousand of files and want to have many folder with only 100 file per folder, run this. It will create 0/,1/ etc and put 100 file inside each one. But find will return true even if it don't find anything ... Show Sample Output


    -1
    folder=0;mkdir $folder; while find -maxdepth 1 -type f -exec mv "{}" $folder \; -quit ; do if [ $( ls $folder | wc -l ) -ge 100 ]; then folder=$(( $folder + 1 )); mkdir $folder; fi ; done
    Juluan · 2011-02-11 21:28:01 0
  • Create a exact mirror of the local folder "/root/files", on remote server 'remote_server' using SSH command (listening on port 22) (all files & folders on destination server/folder will be deleted)


    7
    rsync -e "/usr/bin/ssh -p22" -a --progress --stats --delete -l -z -v -r -p /root/files/ user@remote_server:/root/files/
    storm · 2009-02-11 02:44:00 2
  • This will move a folder and merge it with another folder which may contain duplicates. Technically it's just creating hardlinks of everything in the folder, and after it's done, delete the source (with rm -r source/ ) to complete the move. This is much faster than, for example, using rsync to merge folders which would actually copy the entire contents and so for a lot of files would take much longer. This uses macutils gcp port of cp so it can be used on osx/MacOS. If using in linux or some unix where cp includes the ability to create links with -l you can just use cp instead of gcp.


    2
    gcp -r -l source/ destination/
    fivestones · 2017-02-09 23:48:38 0
  • To use this comment you'll have to create a file entitled 'ignorelist' where you put the file name or pattern of the files you want to ignore. I used it for my maven project which generates the child project files in each folder so I can import them into eclipse. By adding these project files to the ignore list ensure they won't appear each time I run 'svn status'. Show Sample Output


    0
    for folder in $( find $( pwd ) -maxdepth 1 -type d | grep -v .svn ); do svn propset svn:ignore -F ignorelist ${folder}; done
    Highwayman · 2012-08-03 13:50:45 0

What Others Think

You probably want this as md5sum instead of md5.
kboodu · 158 weeks ago
It does more than you describe which is, unfortunately, a problem. tar will encode *everything*, files, dirs and all the filesystem metadata. That makes the command very fragile. Your md5sum is dependent on the contents and names of the files, the directories, the owner/group. . If I copy a directory tree, I would want the md5sum to be the same. But ... tar c folder1 | md5sum 5d41402abc4b2a76b9719d911017c592 cp -a folder1 folder2 tar c folder2 | md5sum 7d793037a0760186574b0282f2f435e7
flatcap · 158 weeks ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: