How to avoid overwrite option with cp, scp command ?

senario : Copy all files from the folder which contains around 20,000 files to the folder where 10,000 same files are already exist.

Now what ? Dont worry simply fire the following command:

# unalias cp

Reason - because cp has an alias which is (alias cp='cp -i')
-i, --interactive which menas prompt before overwrite

Note: Make sure you will revert the changes once you are done with cp

also You can overwrite files without [ y/n ] prompt by using following syntax.

# /bin/cp -pafrH /home/user/source/* /home/user/destination/

Enjoy:)



    0 comments: