1) find all files with a 2 or 3 or 4.jpg 2) delete those files

Joined
Feb 25, 2010
Messages
2
Reaction score
0
Points
1
Man, this is getting ridiculous. In Windows, this would be a simple search and destroy using DOS commands. In Mac, it's harder...

1) find all files in a specific directory with multiple folders in that directory that have a 2, 3, or 4.jpg in the name.
2) delete all those files

Apple support suggested spotlight for all files with a 2 in the name and said I could use *2.jpg but it didn't work. I'm trying "Unix/AIX"-like commands and nothing works. I've downloaded two freeware apps to do this and they don't work.

I don't care if I do this via Gui (but I have hundreds of these files so drag and drop is too tiring) or in the actual OS.

Thanks for your help.
 
Joined
Sep 30, 2007
Messages
9,962
Reaction score
1,235
Points
113
Location
The Republic of Neptune
Your Mac's Specs
2019 iMac 27"; 2020 M1 MacBook Air; macOS up-to-date... always.
I'm no ace with terminal commands, but I'm quite confident this would be quite easily done. The terminal kicks the nuts off of the Windows DOS commands, that much I know. But besides that, it would be insanely simple to build an automator action to do this for you. Just run Automator, start a new workflow and add these actions (along with your custom criteria):

Ask for Finder Items
Get Folder Contents
Filter Finder Items
Move Finder Items to Trash

Works like a charm.
 
Joined
Mar 17, 2009
Messages
3,626
Reaction score
111
Points
63
Your Mac's Specs
2018 15" MBP, 2019 11" iPad Pro, iPhone 11 Pro
I don't understand why your Finder search for "2" didn't turn up any results. Do you have it searching for file name or Contents? Maybe you just need to click on the file name filter. I just did it and turned up lots of files with a "2" in the title. You can filter the search results by file type or name and other such criteria.
Maybe it has to do with the OS you're running. Is it older? This search definitely works in SL.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top