- 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
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
тАО04-06-2011 03:29 AM
тАО04-06-2011 03:29 AM
SolutionChange to:
find /global/xnode/mcel/tap_out -type f -exec ll -rt + |
awk '{if ($6 == "Feb" && $8 != 2010) print $9}' > file_list
scp -p $(< file_list) root@xx.xxx.xx.xx:/dcs/data02_loc/PROD/INPUT/TAPOUT/
You don't have to produce file_list if you want to go crazy and put it all on one line but you may want to keep it around with the two steps.
You can also add "-mtime -$(date +%j)" to find(1) to limit the search to just this year.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 03:34 AM
тАО04-06-2011 03:34 AM
Re: script to copy file from several directories
Don't even think of using find(1) with tar.
Unless the list is "small":
tar -cvf foo.tar $(find /Europe -newer file1 -a ! -newer file2)
# find /Europe -newer file1 -a ! -newer file2 -exec tar cvf {} \;
This puts the file in itself? :-(
Or overwrite the same tarfile you forgot.
>you can use pax if you prefer it:
# find /Europe -newer file1 -a ! -newer file2 | pax -v -w -f /tmp/myarchive
Yes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 04:01 AM
тАО04-06-2011 04:01 AM
Re: script to copy file from several directories
>>Change to:
find /global/xnode/mcel/tap_out -type f -exec ll -rt + |
awk '{if ($6 == "Feb" && $8 != 2010) print $9}' > file_list
the output is:
find: incomplete statement
F.R.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 04:06 AM
тАО04-06-2011 04:06 AM
Re: script to copy file from several directories
find /global/xnode/mcel/tap_out -type f -exec ll -rt {} \+ |
awk '{if ($6 == "Feb" && $8 != 2010) print $9}' > file_list
in short: you need a {} and a + or ; at the end of -exec.
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 04:40 AM
тАО04-06-2011 04:40 AM
Re: script to copy file from several directories
Hi
the output its empty file (file_list)
F.R.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 04:43 AM
тАО04-06-2011 04:43 AM
Re: script to copy file from several directories
first, try without awk...
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 04:52 AM
тАО04-06-2011 04:52 AM
Re: script to copy file from several directories
>>first, try without awk...
I dont understand.
F.R.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 11:34 AM
тАО04-06-2011 11:34 AM
Re: script to copy file from several directories
# find /global/xnode/mcel/tap_out -type f -exec ll -rt {} \+
does it give any o/p?
Unix operates with beer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2011 09:20 PM
тАО04-06-2011 09:20 PM
Re: script to copy file from several directories
This works fine on HP-UX's find(1), using a real shell. What are you using?
>Viktor: in short: you need a {} and a + or ; at the end of -exec.
On HP-UX you don't need that "{}" before the "+" but I probably shouldn't have left it out in my example.
>at first try only this. does it give any o/p?
Right. Is /global/xnode/mcel/tap_out the correct path to "Europe"? Does ll(1) produce any output?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-11-2011 06:54 AM
тАО04-11-2011 06:54 AM
Re: script to copy file from several directories
Sorry, I was away for some days:
yes
" find /global/xnode/mcel/tap_out -type f -exec ll -rt {} \+
" does give me an output:
-rw-r--r-- 1 mcel other 123 Apr 11 08:55 /global/xnode/mcel/tap_out/BENSP/CDMOZ01BENSP02186
-rw-r--r-- 1 mcel other 123 Apr 11 08:55 /global/xnode/mcel/tap_out/NERCT/CDMOZ01NERCT01288
-rw-r--r-- 1 mcel other 123 Apr 11 08:55 /global/xnode/mcel/tap_out/ARGCM/CDMOZ01ARGCM01811
-rw-r--r-- 1 mcel other 123 Apr 11 08:55 /global/xnode/mcel/tap_out/ALBAM/CDMOZ01ALBAM01766
F.R.