- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- removing files based on date?
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
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
тАО05-09-2002 05:28 AM
тАО05-09-2002 05:28 AM
What syntax could I use.
Like if I wanted to remove all files from May 1.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 05:31 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 05:31 AM
тАО05-09-2002 05:31 AM
Re: removing files based on date?
You can use the find command with the -mtime, atime, -ctime option.
eg
find . -mtime 10 -name -exec rm {}\;
-Sukant
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 05:40 AM
тАО05-09-2002 05:40 AM
Re: removing files based on date?
You can also reference an existing file:
find . -type f ! -newer filename | xargs rm
will remove any file older than "filename".
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 05:50 AM
тАО05-09-2002 05:50 AM
Re: removing files based on date?
find . \( -newer refA -a ! -newer refB \) -exec rm -rf {} \;
refA=by touching a file with the starting timestamp
refB=by touching a file with the ending timetamp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 08:04 AM
тАО05-09-2002 08:04 AM
Re: removing files based on date?
for example, if u want delete all files in /tmp which were created/copied/accessed from May 1st, u try the following.
find /tmp -type f -atime -9 -exec rm {} \;
this will delete all the files which were accessed during last 9 days, that is from May 1st to today.
hope this helps
ravi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 08:53 AM
тАО05-09-2002 08:53 AM
Re: removing files based on date?
I use awk for the same like this
rm -i `ls -l | awk '{if($6=="May" && $7=="1") print $NF}'`
this will delete files created on May 1 only , you can be creative with == && >> and <<
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-09-2002 11:33 AM
тАО05-09-2002 11:33 AM