• If you are having any problems posting threads plz message Kate. since latest update we have had 6 members with problems, sorted those but yet to find the problem.

Mac OS Help

Phoebe

Haaa! I kill me
Legend Member
Hi Guys,

Do any of you know of a script I can run to trawl through about 100,000 images, look at the name of file which if more than one create a folder then copy those images into it? This is on MAC O/S,

Test
Test
Test

It would look at those then create a folder called Test and copy those into it. any help would be wonderful

Thanks

P.
 
This is something that you would run through the the mac equivalent of a terminal.

Use one of the AI tools to generate the script,..

foe example

Location of folder if filename equals filename copy to folder name.

A bit of trial an error, but you will eventually get the right tool and the right script
 
This is something that you would run through the the mac equivalent of a terminal.

Use one of the AI tools to generate the script,..

foe example

Location of folder if filename equals filename copy to folder name.

A bit of trial an error, but you will eventually get the right tool and the right script
Yeah, I just get Claude to write most of my scripts these days and then just tweak what it provides. I found Claude to be better at coding than ChatGPT
 
Yes like

test_762_*

Instead of going through doing it manually.
As everyone else mentioned, use ChatGPT or similar to prompt for a terminal command. You'll need to have some very basic familiarity with the Terminal.app, it's in Application -> Utilities or use Spotlight to open it. The command should look something like:

for prefix in $(ls | sed -E 's/(test_[0-9]+)_.*/\1/' | sort | uniq -d); do
mkdir -p "$prefix"
find . -maxdepth 1 -type f -name "${prefix}_*" -exec cp {} "$prefix"/ \;
done
 
Back
Top