HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- remove files by filenames and date
Operating System - HP-UX
1833471
Members
2679
Online
110052
Solutions
Forums
Categories
Company
Local Language
back
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
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
10-02-2003 05:20 PM
10-02-2003 05:20 PM
remove files by filenames and date
Hi
I want to delete the files by filename and date.
if I use
"find /home/test/gr* -mtime +5 | xagrs rm"
it works fine but the problem is I have nearly 30 different files and there is possibility that new files can be added to the directory.
What I want is the script that will look for the filenames and if they are 5 days old delete them.
At the same time I want to delete some files on the same directory after 10 days.
and if new files are added then delete them after 15 days.
thanks
I want to delete the files by filename and date.
if I use
"find /home/test/gr* -mtime +5 | xagrs rm"
it works fine but the problem is I have nearly 30 different files and there is possibility that new files can be added to the directory.
What I want is the script that will look for the filenames and if they are 5 days old delete them.
At the same time I want to delete some files on the same directory after 10 days.
and if new files are added then delete them after 15 days.
thanks
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2003 05:52 PM
10-02-2003 05:52 PM
Re: remove files by filenames and date
How about this,
find /home/test/gr* -name -mtime +5 -exec rm {} \;
find /home/test/gr* -mtime +10 -exec rm {} \;
find /home/test/gr* -name
find /home/test/gr* -mtime +10 -exec rm {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2003 06:21 PM
10-02-2003 06:21 PM
Re: remove files by filenames and date
Hi,
Have a look at the man pages of "find" you'll see many more options you can use with it to fine tune you'r deletion.
like
find -type f -name -mtime +5 -exec rm {} \;
same for 10 and 15 days
Have a look at the man pages of "find" you'll see many more options you can use with it to fine tune you'r deletion.
like
find
same for 10 and 15 days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-02-2003 06:39 PM
10-02-2003 06:39 PM
Re: remove files by filenames and date
Hi,
Can you please elaborate the question? What do you want to do?
You know that in the command that you had given
find /home/test/gr* -mtime +5 | xagrs rm"
the mtime can be changed to 5 or 10 or 15 or whatever you want and executing the commands in sequence will delete the files based on mtime..
Is that what you want to do? or you want to accomplish all these in a single command? or do u want to do something alltogether different?
Can you please elaborate the question? What do you want to do?
You know that in the command that you had given
find /home/test/gr* -mtime +5 | xagrs rm"
the mtime can be changed to 5 or 10 or 15 or whatever you want and executing the commands in sequence will delete the files based on mtime..
Is that what you want to do? or you want to accomplish all these in a single command? or do u want to do something alltogether different?
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP