- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Command to remove files based on specfic dates?
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
02-15-2006 04:34 AM
02-15-2006 04:34 AM
Command to remove files based on specfic dates?
Example: rm all files/dir older than 2005/10/26 in /u20 mount point.
What command would do this?
Thanks,
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 04:37 AM
02-15-2006 04:37 AM
Re: Command to remove files based on specfic dates?
find /start_dir ! -newer /path/ref_file -exec rm {} \;
-or-
find /start_dir ! -newer /path/ref_file | xargs rm
You should probably test with an ll in place of the rm first.
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 04:39 AM
02-15-2006 04:39 AM
Re: Command to remove files based on specfic dates?
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=996188
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 04:40 AM
02-15-2006 04:40 AM
Re: Command to remove files based on specfic dates?
#rm -i /u20 `find....`
hth,
james
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:09 PM
02-15-2006 08:09 PM
Re: Command to remove files based on specfic dates?
touch -t 0510260000 tt
rm $(find /u20 ! -newer tt)
This will remove all file in /u20 older than the file tt (including tt itself).
touch format:
touch -t yymmdd0000
if you want to check files to remove before delete them use rm -i instead.
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:11 PM
02-15-2006 08:11 PM
Re: Command to remove files based on specfic dates?
touch -t 20051026 /file
find /u20 ! -newer /file -exec rm -rfi {} \;
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:25 PM
02-15-2006 08:25 PM
Re: Command to remove files based on specfic dates?
# touch -t 0602101235 sample
# find /directory -newer sample-exec ls -l {} \;
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:33 PM
02-15-2006 08:33 PM
Re: Command to remove files based on specfic dates?
this is an adaptation to one of my scheduled purging script.
Steps:
1. Create a reference file corresponding to your reference date:
touch -t 0602160000 /tmp/referencefile
2. Verify that the list of files to be deleted is OK.
find /u20 -type f ! -newer /tmp/referencefile | xargs ls -l > /tmp/res.log
3. If list of files to be deleted is OK, then delete the files using:
find /u20 -type f ! -newer /tmp/referencefile | xargs rm
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:36 PM
02-15-2006 08:36 PM
Re: Command to remove files based on specfic dates?
--
Muthu