Take the tour ×  Is it possible to construct a command that will
move the file to another directory and if the same file is
already there, generate some random string that is not in the
name of some file in the directory and rename the file to this
random string?  I know the mv -i command, so I do it manually
and files that are contained rename to something else.  thank
you  share|improve this question add comment  2 Answers  up vote
7 down vote accepted mv -b file destination/  should do the
trick.  mv --backup=TYPE  will act like the type says, it is
either of the following:  numbered, t     make numbered backups
existing, nil   numbered if numbered backups exist, simple
otherwise simple, never   always make simple backups
share|improve this answer I tried it as follows mv -b file
destination/ . Now in the destination is file and file~ . I have
another file named file. I used the command mv -b file
destination/ and one file was lost, in destination there is only
file and file~. I expected there will be file