Copy and Paste files into the same directory using Terminal I am currently trying to figure out how to Copy and Paste files (more than one file) into the same directory using Terminal.

I am trying to create a script to create the same file. If there is a better way to do this, please let me know.

What I need to do with this script is to be able to create certain file types with specific sizes. Example: a image file (let's say a PNG file) that is 10MB in size and I need 4 of them. When running a command to create this file in Terminal it looks like:

mkfile 10m image.png

I created a script to repeat the command but it fails as it creates the same file and overwrites it.

Thank you,

K
So, does it matter if the file is the same file?

ie: Let say there is a picture google.png



and you want it to copied into the same dir 4 times.

as an in that directory you would have
google.png google 2.png google 3.png google 4.png?

If thats what you want:

for i in {1..4}
  do
     cp google.png "google$i.png"
  done


But if you want the "images" files to be different, and they are going to be gibrish files, but 10m in size exactly

you wanna do something like 

for i in {1..5}
   do
      dd if=/dev/random of="yourfilename$i.test" bs=12428800 count=1
   done


This will make four files that are 10m in size filled with bunch of random characters.

Comment and let me know what you really want and I can go back and redo this.

It would help if you posted your script that fails so I can see what youre trying to do.

EDIT:

Changed the in device from /dev/zero to /dev/random to generate random file content.