Daniel G. Wilson
Daniel G. Wilson

Reputation: 15055

Automator Apple Script - Conditional Rename/Delete

I've been using automator to batch rename files and it's fantastic! Unfortunately, I now have a problem where every other image in a frame sequence needs to be renamed, and the ones in between deleted. I've come to the conclusion that I'll need an applescript with a conditional statement for the file name's number, but I haven't the slightest idea how to create one.

Basically, I have 60 frames which run at 60 fps, each with the extension ####. (for example, 0000, 0001, 0002, etc.) How can I convert the frames from 60 to 30, by deleting every other frame and renaming the rest to be sequential?

Upvotes: 0

Views: 726

Answers (1)

Lri
Lri

Reputation: 27623

I'd just use a shell script instead:

rm *[13579].png; i=0; for f in *.png; do mv "$f" frame_$(printf %04d $i).png; ((i++)); done

Upvotes: 2

Related Questions