Register
It is currently Wed Jul 23, 2014 4:10 pm

display the total files


All times are UTC - 6 hours


Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Sun Aug 15, 2010 2:04 pm   

Joined: Fri Aug 06, 2010 5:27 pm
Posts: 5
hello any ideea of a script which can display how many files are into a dir or how many dirs are in /

i whant to check some of my directories to see if the backup match with the current server files any ideea how it can be made? thanks


Top
 Profile  
 PostPosted: Mon Aug 16, 2010 2:43 pm   
User avatar

Joined: Sun Jun 27, 2010 12:57 am
Posts: 192
svann wrote:
hello any ideea of a script which can display how many files are into a dir or how many dirs are in /

i whant to check some of my directories to see if the backup match with the current server files any ideea how it can be made? thanks


To check the number of files in one directory you can just simple 'ls /path/to/directory | wc -l'
If you're talking recursively traversing all underlying subdirectories 'find /path/to/directory -type f | wc -l'
You can do the same with directories, just replace '-type f' with '-type d'
You're also talking about checking your backup. Just counting files or directories isn't a very robust way of doing that. Comparing md5 checksums would be a little better 'find /path/to/directory -type f -exec md5sum {} \;'


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP