- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- how to list all changed/added files under file sys...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 08:18 AM
тАО06-14-2006 08:18 AM
Re: how to list all changed/added files under file systems?
add "-type f" to your find command so that only regular files with match.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 08:33 AM
тАО06-14-2006 08:33 AM
Re: how to list all changed/added files under file systems?
Use it like this:
find24.pl /aaa /bbb/ccc /xxx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 08:37 AM
тАО06-14-2006 08:37 AM
Re: how to list all changed/added files under file systems?
I am sorry, but my next follow-up question is how can we sum up the 5th field (amount of space) of each one of files together? I wanted to calcuate how much these new created/modified files will occupy. Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 08:38 AM
тАО06-14-2006 08:38 AM
Re: how to list all changed/added files under file systems?
...and if you wanted to do this with Perl, as Clay suggests:
# perl -MFile::Find -wle 'File::Find::find(sub{print $_," ",scalar localtime ((stat(_))[9]),"\n" if -f && -M _ <1},@ARGV)' /path
...would give you the filenames and modification (mtime) times for all files below "/path".
Change "[9]" to "[10]" if you want the 'ctime' instead of the 'mtime'.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 08:44 AM
тАО06-14-2006 08:44 AM
Re: how to list all changed/added files under file systems?
If you want the total size summation per your last question, just do this:
# perl -MFile::Find -wle 'File::Find::find(sub{$size+=((stat(_))[7]) if -f && -M _ <1},@ARGV);END{print $size}' /path
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 09:07 AM
тАО06-14-2006 09:07 AM
Re: how to list all changed/added files under file systems?
If you can, it'd be better if you can use ksh, since we don't know perl here.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 09:12 AM
тАО06-14-2006 09:12 AM
Re: how to list all changed/added files under file systems?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 09:30 AM
тАО06-14-2006 09:30 AM
Re: how to list all changed/added files under file systems?
OK, if you won't use Perl, even though you have it installed, here's a *pure* shell approach to totalling the file sizes in bytes for all files in "/path" that have been modified during the last 24-hours.
#!/usr/bin/sh
typeset -i TOTSIZE;
find /tmp -xdev -type f -mtime -1 -exec ls -l {} \; | \
while read X X X X SIZE D1 D2 D3 NAME
do
echo "${NAME} ${SIZE} ${D1} ${D2} ${D3}"
TOTSIZE=$(( ${TOTSIZE} + ${SIZE} ))
done
echo "\nTotal Size = $TOTSIZE"
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 09:30 AM
тАО06-14-2006 09:30 AM
Re: how to list all changed/added files under file systems?
OK, if you won't use Perl, even though you have it installed, here's a *pure* shell approach to totalling the file sizes in bytes for all files in "/path" that have been modified during the last 24-hours.
#!/usr/bin/sh
typeset -i TOTSIZE;
find /tmp -xdev -type f -mtime -1 -exec ls -l {} \; | \
while read X X X X SIZE D1 D2 D3 NAME
do
echo "${NAME} ${SIZE} ${D1} ${D2} ${D3}"
TOTSIZE=$(( ${TOTSIZE} + ${SIZE} ))
done
echo "\nTotal Size = $TOTSIZE"
exit 0
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-14-2006 09:52 AM
тАО06-14-2006 09:52 AM
Re: how to list all changed/added files under file systems?
that you shouldn't use the shell for this: possible integer overflow. If enough files are changed within the timeframe to overflow the shell's 32-bit signed integers then your results are bogus. This can be avoided by using bc to do the may=th but at a cost of even poorer performance.
Here's a refined Perl script that will do everything;
Use it like this:
finder.pl -g -s 86400 /dir1 /dir2 ...
This will descend each directory listed and give a total for each for all regular files that have been modified within the last 86400 seconds (1 day) and (-g) list a grand total. Because I intentionally did not do integer arithmetic, the totals will not overflow.
Invoke as finder.pl -u for full usage.