Should I put trailing slash after source and destination when copy folders
cp, linux, unix
Solution
I try to put a trailing `/` on the target.
If I make a mistake and the source and target are both files rather than directories, adding the `/` means that I'll get an error; without the `/` it will clobber the target file.
(Tab completion will usually add the trailing `/` anyway, so it's usually easier to add it than not.)
See Volker Siegel's answer for more details.
Problem
I want to copy: - This folder: `ajax` (`/home/thej/public_html/JC/ajax`). - Into this folder: `/home/thej/public_html/demo/conf/`. The final result will be `/home/thej/public_html/demo/conf/ajax`. I know the `cp` command should be something like: ``` cp -r /home/thej/public_html/JC/ajax /home/thej/public_html/demo/conf ``` My question is: should I put `/` after `ajax`, `ajax/`? should I put `/` after `conf`, `conf/`? I googled online, some put '/', some not, so really confused with it.