[ccoss] Re: seeing how many files are in a directory tree --a solution

  • From: Bill <rivetwa@xxxxxxxxxxxxxx>
  • To: ccoss@xxxxxxxxxxxxx
  • Date: Thu, 27 Nov 2003 21:51:52 -0500

right...that's what I get for not trying it out for rea....

What I actually do is more like this:

(cd src/path; find  . -type f -exec md5sum {} \; ) > src.md5sum
(cd dest/path; find . -type f -exec md5sum {} \; ) > dest.md5sum
diff src.md5sum dest.md5sum


But I also usually do it the first (wrong) way first, before remembering 
this detail!

Cheers,

Bill

Christopher Paulin wrote:

>That solution is perfect after these changes:
>
>chris@p450:~> cut -f 1 -d ' ' src.md5sum > src.md5sum.cut
>chris@p450:~> cut -f 1 -d ' ' dest.md5sum > dest.md5sum.cut
>
>And my actual result of the difference between the CD-ROM files and 
>those copied to the hard drive was:
>
>chris@p450:~> diff src.md5sum.cut dest.md5sum.cut
>chris@p450:~>
>
>No differences! I.e., the files copied byte for byte.
>
>The reason for the cut was:
>
>chris@p450:~> cat src.md5sum | more
>94dc6e3bd83b3cc2e1d222f70498d82d  /media/cdrecorder/Autorun.ICO
>53206fb912c7c1033a172c811cea2260  /media/cdrecorder/Autorun.INF
>035ea2a9ed956511eb1ef3d0bc70a2fe  /media/cdrecorder/IDE/Readme.txt
>e9f2df528fd67e5e14344e75b5e7c1df  /media/cdrecorder/IDE/SiS96x/DATA.TAG
>8238f44e8039dc9ad1b888ff94b036d0  /media/cdrecorder/IDE/SiS96x/DATA1.CAB
>425bb489af8c2b061e773a1abf415163  
>/media/cdrecorder/IDE/SiS96x/DMASETUP/ATA133AP.EXE
>bddd69c1736b33ae898df79d16109eff  
>/media/cdrecorder/IDE/SiS96x/DMASETUP/DMA98.EXE
>750c075251274bb44996532c77244dbb  
>/media/cdrecorder/IDE/SiS96x/DMASETUP/HDINFO.EXE
>b36455d752aaa0a41e3d31f8a433cd1e  
>/media/cdrecorder/IDE/SiS96x/DMASETUP/INFINSTALL.EXE
>98de260969d153afc66b31a48d0a2338  
>/media/cdrecorder/IDE/SiS96x/DMASETUP/SISVSD.VXD
>7286a38effa855e44299ef092877ea2c  
>/media/cdrecorder/IDE/SiS96x/IDEUTIL/SISIDE.EXE
>a7093a506c924581a5490961e18b04fd  
>/media/cdrecorder/IDE/SiS96x/IDEUTIL/SISVSD.VXD
>.........................................Continued........................................
>
>compared with:
>
>chris@p450:~> cat dest.md5sum | more
>94dc6e3bd83b3cc2e1d222f70498d82d  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/Autorun.ICO
>53206fb912c7c1033a172c811cea2260  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/Autorun.INF
>035ea2a9ed956511eb1ef3d0bc70a2fe  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/Readme.txt
>e9f2df528fd67e5e14344e75b5e7c1df  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/data.tag
>8238f44e8039dc9ad1b888ff94b036d0  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/data1.cab
>425bb489af8c2b061e773a1abf415163  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/dmasetup/ata133ap.exe
>bddd69c1736b33ae898df79d16109eff  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/dmasetup/dma98.exe
>750c075251274bb44996532c77244dbb  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/dmasetup/hdinfo.exe
>b36455d752aaa0a41e3d31f8a433cd1e  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/dmasetup/INFINSTALL.EXE
>98de260969d153afc66b31a48d0a2338  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/dmasetup/sisvsd.vxd
>7286a38effa855e44299ef092877ea2c  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/ideutil/siside.exe
>a7093a506c924581a5490961e18b04fd  /mnt/windows_xp/Documents and 
>Settings/temp_cd_copy/ide/SiS96x/ideutil/sisvsd.vxd
>.........................................Continued........................................
>
>Hence, the source and destination directories are different, and so 
>there is a difference. Also copying to a Windows partition changes the 
>case (lower- and upper-case) of some files.
>
>The cut utility gets the first column, which is the md5 sum, i.e, a 
>fingerprint of the bytes in the file.
>
>chris@p450:~> cat src.md5sum.cut | more
>94dc6e3bd83b3cc2e1d222f70498d82d
>53206fb912c7c1033a172c811cea2260
>035ea2a9ed956511eb1ef3d0bc70a2fe
>e9f2df528fd67e5e14344e75b5e7c1df
>8238f44e8039dc9ad1b888ff94b036d0
>425bb489af8c2b061e773a1abf415163
>bddd69c1736b33ae898df79d16109eff
>750c075251274bb44996532c77244dbb
>b36455d752aaa0a41e3d31f8a433cd1e
>98de260969d153afc66b31a48d0a2338
>7286a38effa855e44299ef092877ea2c
>a7093a506c924581a5490961e18b04fd
>.........................................Continued........................................
>
>Christopher Paulin
>
>Bill wrote:
>
>  
>
>>Something I like to do in these cases is:
>>
>>find  src/path -type f -exec md5sum {} \; > src.md5sum
>>find dest/path -type f -exec md5sum {} \; > dest.md5sum
>>diff src.md5sum dest.md5sum
>>
>>This way, especially when a particular OS which is prone to setting a 
>>destination file name and size before all the actual data is copied, I 
>>will know right away which files were in fact successfully copied...
>>
>>Christopher Paulin wrote:
>>
>> 
>>
>>    
>>
>>>I copied a large number of files (including directories) and wanted to 
>>>see if all the files were copied.
>>>
>>>chris@p450:~> find /media/cdrecorder/ | wc -l
>>> 2643
>>>chris@p450:~> find /mnt/windows_xp/Documents\ and\ 
>>>Settings/temp_cd_copy/ | wc -l
>>> 2643
>>>chris@p450:~>
>>>
>>>2643 files are in each directory tree.
>>>
>>>I can exclude, using the not (!) symbol, directories (-type d) to list 
>>>the number of files (non-directories) in the directory tree:
>>>
>>>chris@p450:~> find /media/cdrecorder/ ! -type d | wc -l
>>> 2173
>>>chris@p450:~> find /mnt/windows_xp/Documents\ and\ 
>>>Settings/temp_cd_copy/ ! -type d | wc -l
>>> 2173
>>>chris@p450:~>
>>>
>>>I can exclude, using the not (!) symbol, files (-type f) to list the 
>>>number of directories in the directory tree:
>>>
>>>chris@p450:~> find /media/cdrecorder/ \! -type f | wc -l
>>>  470
>>>chris@p450:~> find /mnt/windows_xp/Documents\ and\ 
>>>Settings/temp_cd_copy/ ! -type f | wc -l
>>>  470
>>>chris@p450:~>
>>>
>>>2173 files
>>>+470 directories
>>>------
>>>2643 files and directories
>>>
>>>Christopher Paulin
>>>
>>>
>>>_______________________________________________
>>>CCOSS mailing list
>>>ccoss@xxxxxxxxxxxxx
>>>CCOSS mailing list page: //www.freelists.org/cgi-bin/list?list_id=3594
>>>CCOSS Web page: http://www.ccoss.org
>>>
>>>
>>>
>>>   
>>>
>>>      
>>>
>>_______________________________________________
>>CCOSS mailing list
>>ccoss@xxxxxxxxxxxxx
>>CCOSS mailing list page: //www.freelists.org/cgi-bin/list?list_id=3594
>>CCOSS Web page: http://www.ccoss.org
>>
>> 
>>
>>    
>>
>
>
>_______________________________________________
>CCOSS mailing list
>ccoss@xxxxxxxxxxxxx
>CCOSS mailing list page: //www.freelists.org/cgi-bin/list?list_id=3594
>CCOSS Web page: http://www.ccoss.org
>
>  
>


_______________________________________________
CCOSS mailing list
ccoss@xxxxxxxxxxxxx
CCOSS mailing list page: //www.freelists.org/cgi-bin/list?list_id=3594
CCOSS Web page: http://www.ccoss.org

Other related posts: