Skip to main content
I deleted the asterisk (it said /source/*) so it doesn't expand file paths (slow operation), (if you put a slash at the end of the source dir, rsync knows you want to transfer the contents of the source folder and not the folder itself). I added z to compress data during transfer.
Source Link

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avh --progressavzh --remove-source-files --progress /source/* user@server:/target \ && find /source -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories – do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avh --progress --remove-source-files /source/* user@server:/target \ && find /source -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories – do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avzh --remove-source-files --progress /source/ user@server:/target \ && find /source -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories – do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

Make even more sense.
Source Link

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avh --progress --remove-source-files /source/* user@server:/target \ &&  find ./source -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories - do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avh --progress --remove-source-files /source/* user@server:/target \ && find . -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories - do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avh --progress --remove-source-files /source/* user@server:/target \ &&  find /source -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avh --progress --remove-source-files /home/user/mystuffsource/* [email protected]user@server:/home/user/backuptarget \ && find . -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories - do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avh --progress --remove-source-files /home/user/mystuff/* [email protected]:/home/user/backup find . -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories - do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

Since --remove-source-files does not remove directories, I issue the following commands to move files over ssh:

rsync -avh --progress --remove-source-files /source/* user@server:/target \ && find . -type d -empty -delete 

I personally like the --progress feature, as I do this transfer manually. Remove it if you're using a script. I expect that it slows down transfers marginally. The find command's delete option only deletes empty directories - do not use rm -rf, as it may delete non-empty directories in case a file was not transferred. The -delete option turns on the -depth option so that empty directory trees are deleted from the "bottom" up.

remove -depth implied by -delete
Source Link
Jeff Schaller
  • 68.9k
  • 35
  • 122
  • 268
Loading
Source Link
Kristian
  • 709
  • 1
  • 6
  • 10
Loading