[mdlug] RSYNC Question

Jonathan Billings billings at negate.org
Thu Sep 28 15:07:18 EDT 2017


On Thu, Sep 28, 2017 at 01:06:04PM -0400, JeremyBekka C wrote:
> I use rsync to keep my computer backed up with my external hard drive. This
> is the command that I use:
> 
> rsync -rltDvu --modify-window=1 --progress --delete --delete-excluded
> --exclude-from=/home/username/Documents/Backup-Exclude-List.txt
> /home/username /run/media/username/Iomega\ HDD/Backup
> 
> 
> This command works fine for routine backups, but there is a problem when
> using it on a new install. For example, I just installed an new Linux OS on
> my desktop computer and ran this command in reverse to put all my stuff
> back on my computer from the external Iomega. Instead of putting everything
> where it belongs, it created a new folder called "Backup" in my /home
> directory and filled it with everything on the Iomega. I had to manually
> move everything back where I wanted it.
> 
> The same thing is happening again now that I want to sync my computer with
> the Iomega. It is putting all my stuff from my computer into another folder
> in the /Backup directory on the Iomega rather than updating the existing
> folders within the /Backup directory.

'rsync' is very careful about the '/' in paths.  I bet if you changed
your path from '/run/media/username/Iomega\ HDD/Backup' to
'/run/media/username/Iomega\ HDD/Backup/' it would have worked.
Because /home/username probably already existed, it thought you were
copying the .../Backup directory to /home/username/Backup.  But with
the trailing slash, it means 'copy the contents of .../Backup into
/home/username. 

-- 
Jonathan Billings <billings at negate.org>


More information about the mdlug mailing list