I am trying to locate all .jpg picture files in my current directory and sub-directories and move them to another directory. I want the source files to overwrite the destination files, but that is not happening. When I run my command, I am getting the following output for some files (but others were moved):
mv: cannot move './file' to '/destination': File exists
Here is the command I am using:
find . -iname *jpg -execdir mv -f {} \;
It seems like the -f (force) option is not working?
When I went back and did mv -f ./source/file /dest
on a single file, it did overwrite properly.
What's the deal? Why is the file not being moved?
UPDATE: The command listed above is not what I actually passed (sheepishly sighs). The actual command did include a destination (as previously suggested in the answer from @Gilles):
find . -iname '*jpg' -execdir mv -f {} /destination \;
I passed this command again to make sure I actually included the /destination directory, and I received the same error:
mv: cannot move './file' to '/destination': File exists
Are there any possible answers to why this error would show, even with a /destination directory in the mv command?
ls -ld /destination /destination/file
show? What doesstrace -s9999 mv -f ./file /destination
show?