Slash or Not to Slash with rsync
November 26, 2022TIL an easy way to remember if you want a slash or not when you run rsync. A trailing slash will copy the contents of the directory while just the directory name will copy the directory itself. For example
# copies everything in dir into new-dir
rsync -r dir/ new-dir
# copies dir into new-dir
rsync -r dir new-dir