- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Find files which were modified for a period of...
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
тАО03-12-2009 11:12 AM
тАО03-12-2009 11:12 AM
I am trying to list out files which were modified on Feb 17, 18, 19th and then, eliminate files from /opt, /var, /tmp, /usr and /stand. Can I achieve it using the "find" string? (Or anyother reliable means) There are atleast 40,000 files therefore, I do not want to eliminate it manually. I was able to achive the first part of my question with the syntax, "# find / -mtime +20 -mtime -23 -exec ls -ltr {} \;", but I am unable to eliminate the listing of the files from the filesystems mentioned above. Any suggestions?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2009 11:20 AM
тАО03-12-2009 11:20 AM
SolutionAre you attmepting to examine '/' without visiting mountpoints? If so, add '-xdev' as:
# find / -xdev ...
As for a range of dates, you can do:
# touch -amt 02170000.00 /tmp/ref1
# touch -amt 02192359.59
# find / -xdev -type f -newer /tmp/ref1 ! -newer /tmp/ref2 -exec ls -lt {} +
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2009 11:22 AM
тАО03-12-2009 11:22 AM
Re: Find files which were modified for a period of 3 days and eliminate /opt, /var, tmp, /usr & stand
This sounds dangerous.
What if you delete the active and the backup kernel or other important files?
Why do you want to do this?
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2009 11:23 AM
тАО03-12-2009 11:23 AM
Re: Find files which were modified for a period of 3 days and eliminate /opt, /var, tmp, /usr & stand
find /home /mydir /myotherdir -type f -newer . . . . . .
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2009 11:29 AM
тАО03-12-2009 11:29 AM
Re: Find files which were modified for a period of 3 days and eliminate /opt, /var, tmp, /usr & stand
I do not intend to eliminate the files from /var, /tmp etc. etc from the server. I just want to get a file list and eliminate files from the listing. (I will use the file listing to perform a restore another server. -That is why I dont need /var, /tmp, /, /stand etc. etc.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2009 11:32 AM
тАО03-12-2009 11:32 AM
Re: Find files which were modified for a period of 3 days and eliminate /opt, /var, tmp, /usr & stand
1) You can pipe it to grep to exclude those names.
2) You can only use find on the filesystems that you want.
3) You can use ! -path to exclude those names.
4) The most efficient would be to use -prune on those directories. (Unfortunately the syntax is complicated.)
You also want to replace that "\;" by "+" and add -d to your ls, or use "-type f".
>Torsten: What if you delete the active and the backup kernel or other important files?
I assume by "eliminate" he meant exclude, not print.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2009 11:33 AM
тАО03-12-2009 11:33 AM
Re: Find files which were modified for a period of 3 days and eliminate /opt, /var, tmp, /usr & stand
find / -mtime +20 -mtime -23 | grep -v -e ^/opt/ -e ^/var/ -e ^/tmp/ -e ^/usr/ -e ^/stand/
This should produce a list of files without any from the file systems you mentioned, while leaving all other mount points in the listing.
HP-Server-Literate since 1979
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2009 09:19 PM
тАО03-12-2009 09:19 PM
Re: Find files which were modified for a period of 3 days and eliminate /opt, /var, tmp, /usr & stand
find / -name opt -prune -o -name var -prune -o -name tmp -prune -o \
-name usr -prune -o -name stand -o \
-mtime +20 -mtime -23 -exec ls -dltr {} +
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-12-2009 09:19 PM
тАО03-12-2009 09:19 PM
Re: Find files which were modified for a period of 3 days and eliminate /opt, /var, tmp, /usr & stand
The problem with -mtime is that it changes every second you delay and it based on the time when you execute the command. It also truncates to a 24 hour period. So JRF's touch may be better.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-13-2009 12:23 AM
тАО03-13-2009 12:23 AM
Re: Find files which were modified for a period of 3 days and eliminate /opt, /var, tmp, /usr & stand
touch -amt 02170000.00 /tmp/mon-date
touch -amt 02192359.59 /tmp/max-date
find / -name opt -prune \
-o -name var -prune \
-o -name tmp -prune \
-o -name usr -prune \
-o -name stand -prune \
-xdev -type f \
-newer /tmp/min-date \
! -newer /tmp/max-date -exec ls -lt {} +
HTH,
Art