Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to write ONE line of command that scp all the sub-directories in a directory to a remote machine

Tags:

linux

shell

unix

something like:

scp -r all_directories_in_current_directory fenix@xxxxx:~/data

anyone can give me a clue?

like image 746
James Bond Avatar asked Jan 23 '23 11:01

James Bond


2 Answers

scp -r * fenix@xxxxx:~/data 

If you only want the directories, not the files in the current directory:

scp -r */ fenix@xxxxx:~/data 

This will not copy hidded(names startingwith a . ) directories.

like image 140
Anonym Avatar answered Jan 29 '23 08:01

Anonym


Use rsync rather thsn scp, e.g.

$ rsync -av ./ fenix@xxxxx:data/
like image 40
Paul R Avatar answered Jan 29 '23 08:01

Paul R