LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-20-2024, 06:44 PM   #1
exerceo
Member
 
Registered: Oct 2022
Posts: 34

Rep: Reputation: 7
Question How to create a checksum of all files in a folder recursively to verify a backup?


After backing up a folder, I would like to verify the integrity of the backup.

Is there a way to create a total checksum of all files?

Something like:
Code:
cat file1 file2 file3 |md5sum
Except with thousands of files in many subdirectories.

A similar solution would be:

Code:
find |xargs md5sum |md5sum
However, this would lead to problems with file names containing spaces, and the "find" command infamously excludes hidden files and folders (starting with a dot) unless manually specified.
 
Old 02-20-2024, 08:09 PM   #2
RandomTroll
Senior Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 1,967

Rep: Reputation: 271Reputation: 271Reputation: 271
I use
Code:
 md5sum * >> /root/md5sums
then check each file. I suppose you could do an md5sum on /root/md5sums to get a single number

Last edited by RandomTroll; 02-21-2024 at 02:52 AM. Reason: Fix typo
 
Old 02-21-2024, 02:01 AM   #3
MadeInGermany
Senior Member
 
Registered: Dec 2011
Location: Simplicity
Posts: 2,796

Rep: Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201Reputation: 1201
Code:
find . -type f -exec cat {} + | md5sum
The
Code:
find . -type f | xargs md5sum
splits at whitespace. Use \0-terminated lines
Code:
find . -type f -print0 | xargs -0 md5sum
or use find -exec with a +
Code:
find . -type f -exec md5sum {} +

Last edited by MadeInGermany; 02-21-2024 at 02:07 AM.
 
Old 02-21-2024, 02:24 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
it depends on the tool you use. For example rsync will do that validation for you, don't need to check it manually.
 
  


Reply

Tags
backup



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
LXer: Collision: Linux App to Verify Checksum of Files Tutorial and Guide LXer Syndicated Linux News 0 05-24-2022 05:33 PM
How can i verify checksum of all files of my OS? liks Linux - Security 1 01-19-2016 02:28 PM
How can i know checksum of BIOS and verify checksum? liks Linux - Security 1 01-19-2016 02:15 PM
[SOLVED] how to list all ascii/text files in a folder recursively? suhasingale Linux - Newbie 3 11-18-2011 01:28 PM
How to search through all files in a folder, recursively... MJBoa Linux - Software 13 09-14-2008 11:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:58 PM.

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