- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- File find/cleanup cron job
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-18-2004 07:53 AM
06-18-2004 07:53 AM
I have a directory tree that's used as a file transfer system between projects. It has a tendency to collect old files, so I'd like to set up a cron job that will delete files older than, say, six months. So:
find /repository -type f -ctime +180 -exec rm {} \;
will do the job. However, in each project subdirectory, there resides a file (named sync.cfg) that cannot be deleted, or the transfer automation will break.
I'm looking for a way to test the name of the found file and skip deleting it (ie, if basename $file != "sync.cfg", delete $file). A one-liner seems preferable to a script, though a script would probably be acceptable.
Any ideas?
Thanks;
Jason
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2004 07:58 AM
06-18-2004 07:58 AM
Re: File find/cleanup cron job
grep -v "full_path_of_file_not_to_be_deleted" /tmp/file_list|xargs rm
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2004 07:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2004 07:59 AM
06-18-2004 07:59 AM
Re: File find/cleanup cron job
find /repository -type f -ctime +180 | grep -v sync.cfg | xargs rm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2004 08:07 AM
06-18-2004 08:07 AM
Re: File find/cleanup cron job
# find /repository -type f -ctime +180 \( ! -name sync.cfg \) -exec rm {} \;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2004 08:09 AM
06-18-2004 08:09 AM
Re: File find/cleanup cron job
Jason