I have a bourne shell script which performs several tasks. One of these tasks is to move some files to certain directory. Today, when I ran the script I got the following message:
mv: will not overwrite just-created <filename> with <sameFilename>
where filename is the original file name with its full path, and sameFilename is exactly the same file and path. I regularly use this script every day and never got this message before.
Right after running the script i re-run it to see if the error persisted, and I was not able to reproduce it again. I am running this script in a Red Hat 5 Enterprise.
Here's how to reproduce it:
> mkdir a b c
> touch a/file
> touch b/file
> mv a/file b/file c/
mv: will not overwrite just-created `c/file' with `b/file'
There may be other ways to reproduce this, but it's reasonable to assume above has happened.
That is, your script moved multiple files with the same name into the same target in one single mv
command. After executing the above you will notice that a/file
was successfully moved (and b/file
left as is), so next time you execute it, the problem will most likely go away.