Ubuntu: the way of writing command


I want to cp a directory but I do not want to overwrite any existing files even it they are older than the copied files. And I want to do it completely noniteractive as this will be a part of a Crontab Bash script. Any ideas? and copy content of file inside file without overwrite ?


You should use cp -n <source> <destination>. Existing files will not be overwritten.


cp -a     archive files    cp -f     force copy by removing the destination file if needed  

cp -i interactive - ask before overwrite

cp -l link files instead of copy

cp -L follow symbolic links

cp -n no file overwrite

cp -R recursive copy (including hidden files)

cp -u update - copy when source is newer than dest

cp -v verbose - print informative messages

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »