I have been searching online to find the answer for getting a list of files that do not match certain criteria but have been unsuccessful.
I have a directory that has many jpg files. What I need to do is get a list of the files that do not match both of the following patterns (I have used the ? to act as any single character-in my case these are stricly numbers):
???-??-????.jpp AND ???-??-????-?mi.jpg
I would like to output the result to a text file.
Once I have this list it would be very helpful if anyone could propose an easy way to rename the files that to not match this pattern.
find . -type f -a \! -name "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9].jpp" -a \! -name "[0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9][0-9][0-9]-[0-9]mi.jpg" -print > outfile
@citaylor - thanks for your replay however from what I see it created a file with all the files in the directory that match that partern. I see that is also continued into the child direcories - I am only interested in finding the files in the current directory.
how can we stop the find from executing recursively into the child directories?
@citaylor - thanks very much for your help - that worked like a charm!
Now that I have a list of these files is there someway I could create a pairing file which I could execute and have all the files renamed as would specified by the pairing file?
Is there a predefined list of these renames, or is there an algorithm we could use to know what to rename the files to ? The latter is easier, but the former isnt difficult either...