- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: how to copy file for a selective date.
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
тАО05-03-2009 06:36 PM
тАО05-03-2009 06:36 PM
I have command below to move file to a specified locator for a selective date.
cd /prod/applprod/prodcomn/temp
touch -t 0706010000 /tmp/start
touch -t 0706052359 /tmp/finish
find . -name '*.t' -xdev -type f -newer /tmp/start -a ! -newer /tmp/finish -exec mv {} /sharef/t \;
my question is , how do I modify the script so that it become copy command to /sharef/t ?
I have tried to change mv to cp , but it seems not working.
please help. thanks
regards
ng
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-03-2009 08:43 PM
тАО05-03-2009 08:43 PM
Solutionhow to copy file for a selective date==>
Yu can do the following:
1. cp /var/adm/syslog/syslog.log /var/adm/syslog/syslog.log_`date +%Y%m%d_%H%M%S`
This will copy the syslog.log appending the current date and time, as for example:
...syslog_20010219_161148
2. set `date +'%d %b %Y'`
DAY=$1
MONTH=$2
YEAR=$3
DATE=$DAY$MONTH$YEAR
Then copy the file to the new location with the $DATE appended to the end.
cp FILE /tmp/FILE.$DATE
3.
# touch -amt 200905040000 /tmp/f1
# touch -amt 200905042359 /tmp/f2
# mkdir /tmp/tardir
# find /pathdir -xdev -type f -newer /tmp/f1 -a ! -newer /tmp/f2 -exec cp {} /tmp/tardir/ \;
# tar -cvf march.tar /tmp/tardir
Rgds-Kranti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-03-2009 09:00 PM
тАО05-03-2009 09:00 PM
Re: how to copy file for a selective date.
You have to give the {} bracket after the destination directory.
find . -name '*.t' -xdev -type f -newer /tmp/start -a ! -newer /tmp/finish -exec mv /sharef/. {} \;
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-03-2009 09:24 PM
тАО05-03-2009 09:24 PM
Re: how to copy file for a selective date.
> seems not working.
I don't see why it wouldn't work, but my
psychic powers are weak, and so I can't see
exactly what you did, or what happened when
you did it. "seems not working" is not a
useful description of anything.
Is "/sharef/t" a directory?
> [...] -exec mv /sharef/. {} \;
I'm beginning to believe that if you wait
long enough in this forum, someone will
suggest that you stand on one leg and scream
like a chicken.
man mv
Which argument is which?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-03-2009 10:35 PM
тАО05-03-2009 10:35 PM