HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: copy file
Operating System - HP-UX
1833758
Members
2380
Online
110063
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
Go to solution
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
07-12-2007 03:51 AM
07-12-2007 03:51 AM
I want to a create directory ( eg. /tmp/staff_info ) , I will daily copy a file ( all files are different name ) to it and remove the file that over 7 days , that means this directory keep the most latest 7 days file , can advise what can i do ? thx
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2007 03:57 AM
07-12-2007 03:57 AM
Solution
You can schedule a job through cron - which will have the line
find /tmp/staff_info -mtime +7 | xargs rm
Using xargs will help in not triggering too many rm commands simultaneously causing system to be loaded during that period.
The normal method would have been
find /tmp/staff_info -mtime +7 -exec rm {} \;
But I prefer the 1st method.
Regards,
Ninad
find /tmp/staff_info -mtime +7 | xargs rm
Using xargs will help in not triggering too many rm commands simultaneously causing system to be loaded during that period.
The normal method would have been
find /tmp/staff_info -mtime +7 -exec rm {} \;
But I prefer the 1st method.
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2007 04:06 AM
07-12-2007 04:06 AM
Re: copy file
A minor point: It is considered bad form to use /tmp for user temporary files; /tmp is for system-related temporary files. Instead, you should use /var/tmp/staff_info. Even better is to observer the TMPDIR convention which says if TMPDIR is defined use that value otherwise default to /var/tmp.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-12-2007 04:47 PM
07-12-2007 04:47 PM
Re: copy file
>Ninad: But I prefer the 1st method.
The correct method is:
find /tmp/staff_info -mtime +7 -exec rm {} +
This calls rm with as many args as will fit.
The correct method is:
find /tmp/staff_info -mtime +7 -exec rm {} +
This calls rm with as many args as will fit.
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