mv - Linux move files without replacing if files exists -


in linux how move files without replacing if particular file exists in destination?

i tried following command:

mv --backup=t <source> <dest> 

the file doesn't replaced issue extension gets changed because puts "~" @ of filename.

is there other way preserve extension filename gets changed when moving?

e.g. test~1.txt instead of test.txt~1

when extension gets replaced, subsequently can't view file double clicking on it.

@aandroidtest: if able rely upon bash shell script , source directory (where files reside presently) , target directory (where want them move to) same file system, suggest try out script wrote. can find @ https://github.com/jmmitchell/movestough

in short, script allows move files source directory target directory while taking account new files, duplicate (same file name, same contents) files, file collisions (same file name, different contents), replicating needed subdirectory structures. in addition, script handles file collision renaming in 3 forms. example if, /some/path/somefile.name.ext found conflicting file. moved target directory name 1 of following, depending on deconflicting style chosen (via -u= or --unique-style= flag):

  • default style : /some/path/somefile.name.ext-< unique string here >
  • style 1 : /some/path/somefile.name.< unique string here >.ext
  • style 2 : /some/path/somefile.< unique string here >.name.ext

let me know if have questions.


Comments