I need to copy a Word doc (it is a different Word document each time) a certain number of times into a new folder and then rename them sequentially starting at a different number.

For instance, I have ThisDoc.docx and I need to copy it 105 times into ThatFolder with the name ThatDoc005.docx starting with value 005 (the numbers need to be always three places).

The result of this should be a folder that contains the 105 copies of ThisDoc.docx but renamed ThatDoc005.docx, ThatDoc006.docx, ThatDoc007.docx, ThatDoc008.docx, etc.

It can be done in Terminal, though, while I have admin privileges on my personal computer, at work, I need to be able to do it in one line.

The Windows Powershell equivalent is:

5 .. 110 | %{cp path/ThisDoc.docx ("path/ThatDoc{0:D3}.docx" -f $_)}

In Automator, I have the problem that I can't access it at work so it needs to be able to be saved as an application that will ask for the first file, the destination folder, the number of times it needs to be copied and and starting file number.

Thank you in advance, for any and all help!

  • This is better suited to the Linux site isn't it? Or super user – OzzieSpin Oct 21 '16 at 19:22
  • @OzzieSpin no because it's referring specifically to an Apple problem in an Apple program – NoahL Oct 22 '16 at 3:41
  • Correct, I guess I should have been more clear, I am using Mac OSX El Capitan 10.11.6 – BunBunRabbit Oct 24 '16 at 16:22

Try this:

for i in $(seq -f "ThatDoc%03g.docx" 5 110); do cp ThisDoc.docx /path/ThatFolder/$i; done
  • Who downvoted this answer? – klanomath Oct 27 '16 at 18:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .