I am wanting to move (not just copy) a group of files/directories to a different directory some of which have name clashes with files/directories in the target directory. My main objective is to move the files, so I can tolerate the non-empty directory being overwritten.
I am currently using mv ... destination
however, occasionally I get
mv: cannot move `target' to /destination/target': Directory not empty
I tried mv -f ... destination
with no success and since I want the files to be gone from their original location, rsync
doesn't seem to be appropriate.
As a bonus, is there a good solution for preserving the files intended to be overwritten somehow maybe by renaming?
rsync
is not what you want; why did you tag this withrsync
? – DopeGhoti Jan 04 '14 at 10:12mv --backup=numbered
or one of the other options for the--backup
switch, thenmv
will complete the merge and preserve the files intended to be overwritten – bsd Jan 04 '14 at 11:11