I want to copy:
ajax
(/home/thej/public_html/JC/ajax
)./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.
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.