Computing.Net > Forums > Unix > tar find ssh

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

tar find ssh

Reply to Message Icon

Name: kabphx
Date: May 17, 2004 at 18:37:03 Pacific
OS: linux
CPU/Ram: p4 512
Comment:

hi
i am trying to get a bunch of zip files from a box to my box and using this command

ssh myname@boxname "( cd /logs; tar cf - find -name \"*.Z\" )" | tar xf -

this command should copy all the zip files from the remote boxname to the local directory while maintaining the same directory structure. but the above command is not working something is going wrong
getting this error message
tar: invalid option -- n
Try `tar --help' for more information.


but if i want to copy the directory structure it is working fine

ssh myname@boxname "( cd /logs; tar cf - w* )" | tar xf -
recursively copies all the directories starting with w*

if you can let me know any other way of copying all *.Z files and maintaining the same directory structure on the local box

thanks

anil



Sponsored Link
Ads by Google

Response Number 1
Name: Dlonra
Date: May 18, 2004 at 14:44:44 Pacific
Reply:

tar cf - find -name \"*.Z\"
looks erroneous

perhaps
tar cf - $(find -name \"*.Z\" )


0

Response Number 2
Name: Dlonra
Date: May 18, 2004 at 14:49:12 Pacific
Reply:

sorry, should be
tar cf - $(find . -name \"*.Z\" )


0

Response Number 3
Name: kabphx
Date: May 18, 2004 at 17:52:46 Pacific
Reply:

i tried the above step now find command in $(find . -name \"*.Z\") is listing all the *.Z files of the local box and not the remote box.

what i have observerd is it is executing only one command on the remote box here on the above command we see that it starts tar cf - on the remote box and whatever is given in `... ` or $(... ) the quotes will be run on the local box not the remote box.

the whole purpose is to get a bunch of *.Z files located in different directories from remote machine to local machine maintaining the same directory structure.

thanks

anil


0

Response Number 4
Name: Dlonra
Date: May 18, 2004 at 18:25:19 Pacific
Reply:

try
ssh myname@boxname 'cd /logs; tar cf - $(find . -name "*.Z")' |tar xf -


0

Response Number 5
Name: kabphx
Date: May 27, 2004 at 10:23:10 Pacific
Reply:

The above step works but it gives error "ksh: /bin/tar: Argument List too Long."
when there are huge number of files is there any other work around.

Need to get a set of *.Z files from one box to the other box maintaining the same directory structure.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon

recursive search of subdi... Split A Report into multi...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: tar find ssh

Tar help www.computing.net/answers/unix/tar-help/6308.html

Maybe useful www.computing.net/answers/unix/maybe-useful/4420.html

find command and tar files www.computing.net/answers/unix/find-command-and-tar-files/5269.html