- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- find and copy
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
03-26-2002 09:55 PM
03-26-2002 09:55 PM
I want to find & copy only those files which are created or modified between 24th March to 30th March from /usr1 to /usr2.
Waiting for the best commad.
Thanks
Animesh
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 10:51 PM
03-26-2002 10:51 PM
Solutionmkdir /tmp/YY
touch -t 03240001 /tmp/XX
find /usr1 -newer /tmp/XX | cpio -pdumv /tmp/YY
touch -t 03300001 /tmp/YY
find /tmp/YY -newer /tmp/XX -exec rm {} \;
cd /tmp/YY
find . -print | cpio -pdumv /usr2
My thought is this. Find all files newer than Mar 24, copy those to a temp dir (using cpio to maintain date), find and remove files newer than Mar 30 and finally copy those to the destination.
Regards,
Trond
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 10:57 PM
03-26-2002 10:57 PM
Re: find and copy
if you mean this year and you will do this on March the 30th then i would do the following.
touch 03240001 testfile
find /usr1 -type f -newer testfile -exec cp -p {} \; /usr2
The touch command creates a new file with the timestamp of 24th March 00:01 (one minute after Midnight).
If you do this for last year or any other timeperiod i think combining several mtime statements will help. Something like:
find /usr1 -type f -mtime +10 -a -mtime -17 -exec ....
This should find every file modified between 10 days ago and 17 days ago.
Hope this helps
Regards Stefan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 11:03 PM
03-26-2002 11:03 PM
Re: find and copy
1) create 2 reference file (Mar23 and Mar30)
# cd /tmp
# touch 03230000 ref1
# touch 03300000 ref2
2) use the negate statement in expression of the find command to get the files you need.
# cd /usr1
# find . \( -newer ref1 -a ! -newer ref2 \) | cpio -pdumx /usr2
It should work, at least close to what you want.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 11:13 PM
03-26-2002 11:13 PM
Re: find and copy
# cd /usr1
# find . \( -newer /tmp/ref1 -a ! -newer /tmp/ref2 \) | cpio -pdumx /usr2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-26-2002 11:15 PM
03-26-2002 11:15 PM
Re: find and copy
I will be doing it on coming 31st March
for this year only.
Thanks
Animesh