Reputation: 109
I just called
find -name '*.wmv' -exec '{}' ../other ';'
where one of the matched files contained spaces like
./blabla - Copy/blabla.wmv
It returned the message
find: `./blabla - Copy/blabla.wmv': No such file or directory
Now the source file is gone and in the target directory 'other' there's only a directory called 'blabla.wmv', but it's empty and I can't find the actual file.
I would have assumed that the command would expand to
mv './blabla - Copy/blabla.wmv' ../other
(with quotes around the source), but even if it expanded to
mv ./blabla - Copy/blabla.wmv ../other
neither of the files 'blabla', '-' nor 'Copy/blabla.wmv' existed so that doesn't explain why the source file is gone and the directory 'blabla.wmv' was created. I'd like to know what really happened.
I don't really care about the file much but I want to be sure that it's not floating around somewhere it's not supposed to or overwrote something that's important.
Upvotes: 0
Views: 3361
Reputation: 69082
There's no mv
in your command.
Try:
find -name '*.wmv' -exec mv '{}' ../other ';'
Filenames with spaces are handled correctly by find.
Upvotes: 2