- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to move files over a certain age to a differen...
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
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
тАО12-03-2009 10:38 AM
тАО12-03-2009 10:38 AM
I need to move a large series of files that are over a certain age, ie: dated or time stamped before January 1 2009, from one directory to another one.
What would the correct syntax be in order to accomplish this? The operating system in question is HP-UX 11.00. Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2009 10:50 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2009 10:53 AM
тАО12-03-2009 10:53 AM
Re: How to move files over a certain age to a different directory
find ./ -type f -mtime +365 -exec mv {} /new/dir/ \;
some form of this should do it..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2009 10:55 AM
тАО12-03-2009 10:55 AM
Re: How to move files over a certain age to a different directory
touch reference -t[[CC]YY]MMDDhhmm[.SS]
find onedir -type f ! -newer reference -exec mv {} /anotherdir \;
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-03-2009 01:17 PM
тАО12-03-2009 01:17 PM
Re: How to move files over a certain age to a different directory
Thanks for your responses. I implemented Tim Nelson's suggestion, and it worked very well.
I will make sure to assign points to both of you, and even though I did not use Pete Randall's method, the least I can do is to give points as gratitude.
Thanks again to you both.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2009 04:14 AM
тАО12-04-2009 04:14 AM
Re: How to move files over a certain age to a different directory
just a note: mv can handle multiple parameters too, so this solution would be faster than the above
find ./ -type f -mtime +365 -exec mv {} /new/dir/ \+
note the + sign at the end instead of ; -> this feeds all the founded files to a single mv process
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-04-2009 05:14 AM
тАО12-04-2009 05:14 AM
Re: How to move files over a certain age to a different directory
Except you can't get there from here.
>find ./ -type f -mtime +365 -exec mv {} /new/dir/ +
The Posix standard only allows you to put the {} right before the +.
See these other threads where I introduce an auxiliary script to do the work:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1331996
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1133772
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1383497
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1111050