- 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
Forums
Discussions
Discussions
Discussions
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
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 05:25 AM
06-14-2006 05:25 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 05:30 AM
06-14-2006 05:30 AM
Re: how to list all changed/added files under file systems?
Short of that, go to each file system and run:
cd /filesystema
find . -xdev -depth -mtime 0 -exec ls -al {} \; > /tmp/changed_file_list.log
If you want to do the whole server and are willing to wait...
cd /
find . -depth -mtime 0 -exec ls -al {} \; > /tmp/changed_file_list.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 05:33 AM
06-14-2006 05:33 AM
Re: how to list all changed/added files under file systems?
If by "changed" you mean 'modified' do:
# find /path -xdev -mtime -1
This finds all files in /path that have been modified in the last 24-housrs where each increment equals 24-hours.
If you mean an "chage" in permissions, ownership or modification, use:
# find /path -xdev -ctime -1
The 'ctime' tracks changes in a file's inode.
See the manpages for 'find' for more information!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 05:34 AM
06-14-2006 05:34 AM
Re: how to list all changed/added files under file systems?
0 = last 24 hours
1 = 24 to 48 hours ago
+1 = more than 48 hours ago
+0 = more than 24 hours ago
etc...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 06:28 AM
06-14-2006 06:28 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 06:34 AM
06-14-2006 06:34 AM
Re: how to list all changed/added files under file systems?
Rsync is a tool to sync two file systems together,
but ...
You "can" use rsync in a "dry-run" mode to see the files that need to change since the last rsync, IF that was 24 hours ago, AND the source machine that you're rsyncing from *hasn't* changed in the last 24 hours. It can get a little funny over file deletes though...
man rsync and look for the "dry-run" option...
"--dry-run" would be the command to merely review the changes that rsync would make.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 06:40 AM
06-14-2006 06:40 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 06:41 AM
06-14-2006 06:41 AM
Re: how to list all changed/added files under file systems?
You're original query suggested that all you wanted was to list files that have been changed or added during the last 24-hours.
The 'find' command used as I showed accomodates this quite easily. You can redirect your output to a file if you want!
Remote file synchronization/distribution is designed to tranfer from one server to another files that have been changed. You don't need that layer simply to see files modified/changed!
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 08:04 AM
06-14-2006 08:04 AM
Re: how to list all changed/added files under file systems?
find . -xdev -depth -mtime 0 -exec ls -al {} \; > /tmp/changed_file_list.log
# find /path -xdev -mtime -1 -exec ls -at {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-14-2006 08:15 AM
06-14-2006 08:15 AM
SolutionI'm sorry, I should have restricted things to *files* only:
# find /path -xdev -type f -mtime -1
# find /path -xdev -type f -ctime -1
Also, far kinder on your system's performance is the use of 'xargs' instead of '-exec':
# find /path -xdev -type f -mtime -1|xargs ls -l
...The above does the same thing as:
# find /path -xdev -type f -mtime -1 -exec ls -l {} \;
...but the 'xargs' filter bundles *multiple* filenames and runs then as "one" instatantiation of 'ls'.
Please see the 'xargs' manpages for more information.
Regards!
...JRF...
- 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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2006 09:56 AM
06-16-2006 09:56 AM
Re: how to list all changed/added files under file systems?
Sorry for confusing, and appeciate your messages.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2006 10:21 AM
06-16-2006 10:21 AM
Re: how to list all changed/added files under file systems?
Hanry, this would be easier if you more clearly stated the objective you want met. That said, however, have a look at 'rdist' and its manpages. Examples are included therein:
http://www.docs.hp.com/en/B2355-60127/rdist.1.html
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2006 10:41 AM
06-16-2006 10:41 AM
Re: how to list all changed/added files under file systems?
http://hpux.cs.utah.edu/hppd/hpux/Networking/Admin/rsync-2.6.8/
One very nice feature of rsync over rdist it the ability to transfer just the parts of a file that have changed -- and this becomes very important over busy or limited-bandwidth connections. The downside to the partial transmissions is that more computation has to be done so you will need to try it both ways to find out which is better for your application. The -n option while actully list whay rsync would do without actually doing the transfer. You really shouldn't need anymore than the rsync man pages as there are several examples.