Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-02-2010, 02:31 PM   #1
Registered: Dec 2009
Distribution: Slackware 14
Posts: 282

Rep: Reputation: 64
sha1sum a folder and files?

Is there anyway to make a hash (or similar), of a folder of files, for data integrity purposes?

I tried with sha1sum, but it cant do it.

Is it possible with some other software?

Last edited by clifford227; 11-02-2010 at 02:32 PM.
Old 11-02-2010, 06:17 PM   #2
Senior Member
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Stretch (Fluxbox WM)
Posts: 1,389
Blog Entries: 52

Rep: Reputation: 355Reputation: 355Reputation: 355Reputation: 355
You can do this with sha1sum, but there are some issues when trying to do this on a group of files.

For example, if you were just doing a bunch of files, you can do something like the following (where the '-' parameter tells sha1sum to use standard input):
sha1sum * | sha1sum -
That won't recurse into the subdirectories, or include the meta-data in the sum.

Or you could do something like this:
tar cO --mtime=0 . | sha1sum -
This will recurse, and include the meta-data. However, the checksum will be dependent on the order in which the files are collected, and you will have to perform the command from the same relative location. You might also want to change the tar parameters depending on which metadata should be included or excluded.

Last edited by neonsignal; 11-02-2010 at 06:25 PM.
Old 11-02-2010, 06:23 PM   #3
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 612

Rep: Reputation: 32

did a good job for me....


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
i need to copy files from one folder to another folder using shell anurupr Linux - Newbie 17 03-04-2010 10:07 AM
Impossible to change files attributes to all files in the folder maiden2 Linux - Software 1 09-30-2008 06:09 AM
How to automatically move files from one folder into another folder? xmrkite Linux - Software 6 11-05-2006 11:39 AM
sha1sum frolicchap Fedora 3 01-22-2006 07:48 AM
IglooFTP-PRO refuses to upload files in folder when I upload folder eBopBob Linux - Software 0 08-27-2004 06:52 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:23 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration