I have access via SSH console to a folder in an AWS service, how can I download an entire folder to my local PC?
I've tried something like ~$ wget filename
and it doesn't work... what it does is try to find "http://filename", that is, it tries to find it in the global network and the file or folder to download in this case is locally on the server
Both answers.. in the end a local friend pointed out to me that I could use the same IDE I use to develop "PHP Storm" to set up this download and from there - everything was very easy... Thanks to Marco the first thing I did was to compact the entire folder to make it easier to have everything in one file and then taking Abraham Guerrero's suggestion of using an SFTP connection. Thanks friends !!!
With
scp
Assuming your folder is on
/home/tu_usuario/carpeta1
the remote computer.Inside your instance, enter one level earlier with
cd /home/tu_usuario/
Create a file
.tar.gz
from that folder withtar czf carpeta1.tar.gz carpeta1
Log out of your session
ssh
on that EC2 instance.Copy the file
tar.gz
to your local machine withWhere the dot "
.
" indicates the current directory. After this you will have the filecarpeta1.tar.gz
in your current directory.unzip with
tar xf carpeta1.tar.gz
You can do it without the file
tar
with the parameter-r
, if you don't care about compression, for example.Through the "sftp"
Download some sftp client and configure it with the path, ip, password or private key of the EC2 instance. Even editors like Atom or Sublime Text have packages that allow you to use sftp for file transfer.
with the customer of
ssh
A quick way to do it and in one line is, in short, on the remote computer go to the folder level and then compress it, send the compressed to stdout and that stdout receive it on the local computer with a decompression. All in one line.
Example.
Assuming that the folder you want is located in
/tmp
and is calledcarpeta1
, you can apply any of these options.EITHER
And, inside the path where you have run that command you will find the folder called "folder1" unzipped.
With
rsync
The parameters
-v
, and-h
are to make the process verbose,-a
which is in file mode and-z
indicates that the file will be compressed during the transfer.Hello, I suggest you install an ftp client on your computer, I recommend FileZilla, but when configuring your connection you will select the SFTP protocol to be able to use SSH
if you do it from a fast connection fill the data and use port 22
Use -r to make it recursive. For example:
Or in your case if you want it to be copied into the directory where you are positioned with ./
Cheers!