How to rsync from remote properly? - rsync

I am trying to sync a remote directory to the local system directory wimagasin inside the htdocs on the mamp server.
I ran the command from my local htdocs directory:
rsync -avr deploy#wimagasin.se:public_html/wimagasin.se wimagasin
But when the command is run, the sync creates completely new directory wimagasin.se inside my local wimagasin directory. I am not sure what is the right way to do this?

You should just append a slash at the source:
rsync -avr deploy#wimagasin.se:public_html/wimagasin.se/ wimagasin

Related

Rsync Specific Listed Files from specified Server Directory

I'd like to rsync specified files from a specific server folder to my local directory (in which I am running the command).
However, I'm getting the error failed: No such file or directory (2). There seems to be something wrong with my syntax and I'm not sure its picking up the source directory properly
This is my command...
rsync -az . remoteSite.com::remoteFolder/remoteSubFolder/ --files-from=filelist.txt
filelist.txt, which it seems to be finding, contains filenames within remoteSubFolder
file1.xml
file2.xml
etc
What am I doing wrong?
Thanks to #Gordon Davisson.
I now understand that the full stop represents the local directory and goes after the remote host and directory.
rsync -az --files-from=filelist.txt remoteSite.com::remoteFolder/remoteSubFolder/ .

sftp uploading to non-existing directory

Say I have to upload file dir-a/dir-b/dir-c/xxx.txt using sftp
Should I create the target directory first?
Should I open target directory before copying the file?
If have to create this path dir-a/dir-b/dir-c - is it one command or three?
Should I create the target directory first?
Usually yes. SFTP servers usually do not create parent directory. But how hard is it to try first?
Should I open target directory before copying the file?
You do not have to. put command does accept a remote-path, which can be either absolute or relative to remote working directory.
If have to create this path dir-a/dir-b/dir-c - is it one command or three?
These are three commands:
mkdir dir-a/
mkdir dir-a/dir-b/
mkdir dir-a/dir-b/dir-c

meteor specify working directory in container

I'm trying to install a meteor application inside a container (singularity), but when I start the application it wants to write to a read only part of the image. Is it possible to specify a working directory different from the application directory? Or, start the application from a writeable directory and point to the applications install directory?
.../promise_server.js:165 throw error;
Error: EROFS, mkdir '/usr/local/mindcontrol/.meteor/local'
Did you install the application to /usr/local yourself? Maybe you can install it to another directory inside the container, e.g. /mindcontrol.
Then you can mount a directory for which you have write-permissions (your home for example):
singularity exec --bind <some_dir>:/mindcontrol <container.img> <command>

How to Copy a Local Directory to an Apache Server

I have a directory on my desktop and need to copy it to my server. I've looked up a command to do this being
scp -r /path/to/local/storage user#remote.host:/path/to/copy
but when I run it, it just tells me "No suck file or directory".
First of all is this the correct way to do this or is there an easier way to take a directory from local storage and put it onto an apache server? Once I get it on the server I can move it around just fine there. I just need to get it on there!
the path I'm using right now for local is
/Users/byw5k_000/Desktop/myWebsite
with myWebsite being the directory I want to copy onto my server.
I'm curious if I'm getting the path incorrect. What is the correct path to the desktop on a windows 10 computer and will this work for me to copy an entire directory onto an apache server?
You could try changing to your Desktop directory like this:
cd C:\Users\(username)\Desktop
and then running:
scp -r myWebsite user#remote.host:/path/to/copy
Should work as ling as you can change to your Desktop directory

Rsync link destination folder

I am using rsync to back up a folder on a local machine to a remote machine.
The link destination folder is on the remote machine as is the target. When using the command line it works fine - using link-dest=../../link - that being the location relative to the target directory. When I try to put this into a script on the local machine it failed to exec --link-dest=../../link. In the script I have a variable LNK="../../link/" and TRG="remote#user:home/user/target. I am pretty new to scripting but this has stumped for a few days now.
I did try the full path on the LNK variable remote#user:home/user/link - same result

Resources