Terminal Command for certain way of copying files

Joined
Apr 22, 2016
Messages
2
Reaction score
0
Points
1
Hello all, i know how to perform this on windows, but i just seem to figure it out on the mac terminal. What i want to do is take a file and make x number of copies of it all numbered sequentially. For example if i have a file named "file1.png" i want to make copies of it named "file2.png", "file3.png", all the way through file "file1000.png". Anyone have a solution?
 
Last edited:
Joined
Apr 16, 2016
Messages
1,096
Reaction score
51
Points
48
Location
CT
Your Mac's Specs
MacBook Air Mid-2012 / iMac Retina 5K Late-2014
The long-hand way is to do "cp file1.png file2.png", "cp file1.png file3.png", etc.

The short-hand way is to do this:

for ((f=2; f<=1000; f++)) ; do cp file1.png file$f.png; done
 
Joined
Apr 16, 2016
Messages
1,096
Reaction score
51
Points
48
Location
CT
Your Mac's Specs
MacBook Air Mid-2012 / iMac Retina 5K Late-2014
The terminal on the Mac is a bash shell (actually, bash is an acronym for Bourne-Again SHell - Bourne shell was the original). Anything you want to do there, look up how to do it in bash.

Click the little thumbs up under my previous post if that solves your problem.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top