I need to move all images with a specific filename string to a specific directory.
This is an example filename
facility_92+SOURCE1+SOURCE1.0
After the 'facility_' there can be 1 to 5 digits.
The following will return a list of the files I wish to move:
ls | egrep "facility_([0-9]*)\+SOURCE[0-9]*"
However I get stuck when trying to move anything this returns. I have tried to use find to move matching files to the moved folder:
for f in 'find ./ | ls | egrep "facility_([0-9]*)\+SOURCE[0-9]*"'; do mv $f moved/; done
But am get a number of errors where mv parses the conditions as a string ...
I had another go with '-exec':
find ./ | ls | egrep "facility_([0-9]*)\+SOURCE[0-9]*" -exec mv moved
But receive similar errors ...
Advice appreciated. Am I wrong to try this approach at all? Should i just figure out how to do the same regex in 'find'?