I have a ton of files and dirs in a subdirectory I want to move to the parent directory. There are already some files and dirs in the target directory which need to be overwritten. Files that are only present in the target should be left untouched. Can I force mv
to do that? It (mv * ..
) complains
mv: cannot move `xyz' to `../xyz': Directory not empty
What am I missing?
mv
is faster because you're on the same filesystem? What if you usecp -l
to create hardlinks rather than actually moving the files? – mattdm Mar 22 '11 at 20:32cp -a
instead ofcp -r
in order to preserve the file attributes (timestamp, permissions, etc.). – dotancohen Feb 02 '14 at 07:14cp -rl source destination && rm -r source
. – William Everett May 31 '16 at 17:43rm -rf
, be sure to specify the folder name at the end and to not use variables if you are in script, you might end up runningrm -rf /
and this will "kind" break your server. – Evis Jul 07 '21 at 14:24