0

I have batch of files named A-01.pdf, A-02.pdf, B-01.pdf, B-02.pdf.... Then I have folder structure 01, 02, 03,.... How can I move all the files with 01 in there name to folder 01, all with 02 to folder 02 and so on?

There are a lot of scripts on the net but none of them seams to fit my case.

2 Answers 2

1

Assuming that these files are all in the same folder and the numbered folders are part of that folder as well, open Terminal and run

cd path/to/folder for i in *.pdf; do mv "$i" "${i:2:2}/" done 
1

A script like @patrix's is probably the most efficient way, but if you're not comfortable with running shell scripts, you could do it with Automator, with a workflow that looked something like this:

First steps of potential workflow

and so on for -03, -04 etc. (There's probably an even more efficient way to do it with Automator using loops and variables, but I've never tried using those...)

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.