Skip to content

Instantly share code, notes, and snippets.

@alexjsteffen
Created October 10, 2024 02:50
Show Gist options
  • Save alexjsteffen/4e15d408749bc5c9e0acda415f763cd4 to your computer and use it in GitHub Desktop.
Save alexjsteffen/4e15d408749bc5c9e0acda415f763cd4 to your computer and use it in GitHub Desktop.
This document provides instructions for using the rsync command to move a folder on a PC while displaying progress and removing the source files after copying.

To move a folder within the same PC using rsync, while showing progress and verbose output, you can use the following command:

rsync -a --info=progress2 --remove-source-files /path/to/source/folder/ /path/to/destination/folder/

Breakdown of Options Used:

  • -a: This stands for "archive mode", which preserves permissions, timestamps, symbolic links, and other attributes while copying.
  • --info=progress2: This option provides detailed progress information for each file.
  • --remove-source-files: This option deletes the source files after they have been copied. Note that it does not delete directories; you will have to remove the source directory separately if intended.
  • Ensure to include a trailing slash (/) after the source folder path if you want to copy the contents of the folder rather than the folder itself.

After running this command, you might want to remove the now-empty source folder with:

rmdir /path/to/source/folder

Make sure to replace /path/to/source/folder/ and /path/to/destination/folder/ with the actual paths to your source and destination directories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment