You can use Linux mv command with -n or –no-clobber option to not overwrite destination file/directory. If -i -n and -f options are provided together with mv command only the final option gets effective.
1 2 3 4 5 6 7 8 |
mkdir mydir1 mydir2 ## create some files and directory echo "one" > mydir1/myfile1 echo "two" > mydir2/myfile1 mv -n mydir1/myfile1 mydir2 ## overwriting not allowed, does nothing cat mydir2/myfile1 ## returns two rm -r my* |