idforpg1
asked on
prompt before overrite : cp in linux
Hi,
I am new to linux. I use following command but still get interactive prompts "overite ?" for each file. I want to over rite all existing files at destination dir i.e. like "yes to all" in windows.
cp -f -r [source dir] [dest dir]
any suggestions or idea? All I want to do is copy all files and sub directories from source to dest (overwrite files at dest)
I am new to linux. I use following command but still get interactive prompts "overite ?" for each file. I want to over rite all existing files at destination dir i.e. like "yes to all" in windows.
cp -f -r [source dir] [dest dir]
any suggestions or idea? All I want to do is copy all files and sub directories from source to dest (overwrite files at dest)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is there a file "-i" in source_dir?
If so, and if you are not willing or allowed to delete it, use
cp -r -- [source dir] [dest dir]
wmp
If so, and if you are not willing or allowed to delete it, use
cp -r -- [source dir] [dest dir]
wmp
I would not recommend getting rid of the alias from the profile/bashrc permanently. It is safety net that is needed by everyone no matter how experience one has. One day this would haunt you when you would lose something important. Temporary unaliasing by prefixing the command by \ is safer way.
\cp -f -r [source dir] [dest dir]
however note that with that the sourcedir would be copied inside the destdir. You should use
\cp -f -r [source dir]/* [dest dir]