I'm using rsync to essential fetch files off a server, then delete the files from the server once I have them locally. The full command I'm running is below.
This does successfully delete the files on the source server, however empty directories still remain. I don't get any messages or errors. All output is normal. Perhaps this is the intended functionality.
How can I tell rsync to clean everything, including the directories?
rsync --progress -vrzh --remove-source-files
Version is 3.0.9 on both ends.
Best Answer
The behavior of
--remove-source-files
that you observe is exactly that specified byman rsync
:There is no specific command to remove the directories, as these two discussions in StackExchange and ServerFault clearly show. The solution suggested there is to issue two separate commands:
The last piece of the command suggested in these two posts,
which is needed to remove the (now emptied) source directory has this form in these posts because the OPs and the answers are using rsync to move large amounts of files within the same machine. In your case you will have to do this manually.