1 year ago

#75599

test-img

Maxigalaxi

Issue when using find and ls command and wildcard operators in terminal mac os x

First of all thank you to everyone on here you have already helped me countless times. Secondly be kind I'm a total noob with these things and spent the last 2 hours trying to find an answer.

Here is my issue:

I have a large amount of media files that have automatically been resized for web (i.e. 1920x1080 resolution down to 960x540 -> 480x270 etc.). These resolutions have been added to the filename. I need to move that media library to a different web server but need to avoid to copy all these low res duplicates.

I have found this: sudo find DIRECTORY_PATH -name "*filename*" -delete

which lets me specify the resolution of that specific file and then it will delete all the instances with that resolution. The issue is that specifically with image files they are all different resolutions and as they are being resized according to their original aspect ratio i would need to write this command a thousand times.

What I would like to do is specifiy a numeric range before the resolution marker i.e.:

sudo find DIRECTORY -name "*[0-2000]x[0-2000]*" -delete

However that doesn't seem to work. I feel the answer is very simply and I apologise for wasting your time but I can't make it work. I have tried all kinds of different variations of this.

I managed to list the files using ls

ls *[0-3000]x*

Thanks in advance for your help!

macos

terminal

find

wildcard

ls

0 Answers

Your Answer

Accepted video resources