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

  • From: Christopher Paulin <cpaulin@xxxxxxx>
  • To: ccoss@xxxxxxxxxxxxx
  • Date: Thu, 27 Nov 2003 19:10:56 -0500

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

Other related posts: