Copy files from subfolder to folder using SSH

How to copy all files inside /directory/subfolder to /directory using SSH?

PS. I don’t go from 1 server to another, I’m just trying to copy files to a subfolder to update the site ...

+4
source share
7 answers

I'm not too familiar with SSH, although I used WinSCP to do what you requested using an SSH connection. It was pretty easy, although I didn't have to deal with server-side settings.

+4
source
 scp -r /directory/subfolder/* user@host :/directory 
+13
source
 cp -a <from-path> <to-path> 

may look like

 cp -a /var/www/site.com/dir/ /var/www/newsite.com/dir/ 
+3
source
 scp -r user1@from-server :/dir1 user2@to-server :/dir2 scp -r local-directory user2@to-server :/dir scp -r user1@from-server :/dir local-directory 
+1
source

I believe that you are looking for sftp and, in particular, the put command. Below is the sftp documentation .

0
source

Depending on your needs and the underlying OS. If you are on a box with X / windows and are trying to copy files, you can use FileZilla, WinSCP and upload files via sftp. Another nice method is to use ExpanDrive, MacFusion, WebDrive or WebDrive for MAC and just mount the external directory as a local drive. If you are only interested in a console solution, you might want to take a look at scp.

0
source
 PULL: # ssh target_address cat remotefile > localfile # ssh target_address dd if=remotefile | dd of=localfile # ssh target_address cat "<" remotefile >localfile # ssh target_address cat "<" remotefile.gz | gunzip >localfile 
0
source

Source: https://habr.com/ru/post/1286655/


All Articles