Novice Novice - 10 months ago 44
Linux Question

Secure copy with parent directory

I have a set of files on a remote server structured like this:


I would like to copy these files to my local computer and create their immediate parent directories. I tried this in bash but it does not work:

scp name@remote.server:~/dir_*/file ./

Would appreciate any help. I am using Mac OSX.


Use globbing on remote server to match file only in the subdirs + tar to create the the complete hierarchy

ssh name@remote-server "tar cf - dir_*/file"|tar xf -