1

I have some 70,000 files (basically duplicates) most of which match a name pattern like name(1).ext, name(2).ext .... name(10).ext. However among these files there are others named name (xwz).ext.

Now what I want to do is finding all the first type files and move all of them to a destination folder; I looked to several answers on superuser and I manage to do the following:

first I used the find command to find the files this way:

find ~/sourcedir -name "*([0-9]).*" -o -name "*([0-9][0-9]).*"

which retrieve all the files I want (I printed them on a file and got more than 73,000 files); then I tried to pass them to the Move command this way:

find ~/sourcedir -name "*([0-9]).*" -o -name "*([0-9][0-9]).*" -type f -exec mv {} ~/destinationdir \;

however doing that, just one file is moved to destination (the last one in the list) or none ; what's wrong here? why can't I move all the files in destination dir ?

yet, if I use only one option in the find command, say:

find ~/sourcedir -name "*([0-9]).*" 

and then do the -execmv it works, but not if use both options;

indeed it looks like it's processing just the second option (as the only moved file is the one which match the second option); how can I pass all the files matching either the first or the second option to 'move'?

bigo
  • 19

0 Answers0