- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script to copy file from several directories
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
04-12-2011 01:56 AM
04-12-2011 01:56 AM
Re: script to copy file from several directories
I did not pursue your went for your suggestion because I did not understand it very well, but I am going to try, for March . But your Europe directory needs to be replaced by /global/xnode/mcel/tap_out path?
>>First, I would create two marker files. >>file1 should have a timestamp of february >>1st, file2 february 28.
>># touch -t 201102010000 file1
>># touch -t 201102282359 file2
>>With these two, the following find command >>will result in all the files you need to >>copy:
>># find /Europe -newer file1 -a ! -newer >>file2 -print
>>With this, you can generate a file list, >>tar it and scp it. I'm not sure if you >>want to copy these with full path or not, >>but you can achieve both with tar.
>>you can use the exec option of find:
>># find /Europe -newer file1 -a ! -newer >>file2 -exec tar cvf {} \;
>>or you can use pax if you prefer it:
>># find /Europe -newer file1 -a ! -newer >>file2 | pax -v -w -f /tmp/myarchive
>>Regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2011 02:25 AM
04-12-2011 02:25 AM
Re: script to copy file from several directories
basically you create two files, one with a timestamp for the beginning of the month and one for the end of the month. You do this with the -t option of touch:
# touch -t 201102010000 file1
# touch -t 201102282359 file2
after this, you can search for files what are newer than file1 but older than file two - practically these are the files from the whole month. Once you understand this, you can search for files with any timestamp on your system.
# find /Europe -newer file1 -a ! -newer file2 -print
and yes, in my example /Europe was only a "testdir", I don't know your environment so couldn't supply a solution which fits your system.
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2011 02:28 AM
04-12-2011 02:28 AM
Re: script to copy file from several directories
Hi Viktor
I am going to do it for march them I let you know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-12-2011 04:06 AM
04-12-2011 04:06 AM
Re: script to copy file from several directories
> # touch -t 201102282359 file2
I'm more accustomed to VMS, where /BEFORE
really means "earlier than" and /SINCE means
"equal to or later than", so I know nothing,
but if one doesn't wish to leave a hole at
midnight, then shouldn't those be either:
# touch -t 201102010000 file1
# touch -t 201103010000 file2
(if "-newer" really means "as new as") or
else:
# touch -t 201101312359 file1
# touch -t 201102282359 file2
(if "-newer" really means "newer than")?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2011 02:09 AM
04-13-2011 02:09 AM
Re: script to copy file from several directories
Right:
# touch -t 201101312359 file1
# touch -t 201102282359 file2
True if the current file has been modified more recently than the argument file.
F > file1 and F <= file2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-13-2011 06:25 AM
04-13-2011 06:25 AM
Re: script to copy file from several directories
"-newer" is another of those things where VMS
appears to have been thoughtfully designed,
while UNIX appears to have been thrown
together by someone in his spare time.
Having to figure out the last valid time
value before the time you really care about
would be even more annoying on VMS, where
file date-time values are maintained to
0.01s. For example:
Created: 17-FEB-2011 06:15:21.58
Revised: 17-FEB-2011 06:15:21.65 (1)
Expires:
Backup: 2-APR-2011 00:58:15.36
All those ".99" things would certainly annoy
me, if I had to use them. (But I don't.)
- « Previous
-
- 1
- 2
- Next »