I am a new user of macOS, so please accept my apology in advance if my question sounds very trivial or stupid.
I have a folder that contains 13000 images. I want to transfer those images into three different folders in such a way that five thousand images go into two different folders each and remaining 3 thousand go into the third folder.
After searching for a while, I used the following command to transfer first 5000 images but it didn't work. Here are my steps:
-
I went into the source folder that contains the images
-
Used this command to copy the images
cp head -5000 ../Paras_valid
, but it did not work.
Could anyone help me how to copy the multiple files into different folders?
Best Answer
This is more difficult than it may seem. The following assumes that all images to be copied are in the same directory (no sub directories).
Replace
-name '*.JPG'
to mach your images andTARGET1
etc by the actual names. If you run the code like that it will just print the commands. Remove theecho
if the commands seem to be correct.PS: It's probably easiest to put everything in a file with
#!/bin/bash
in the first line, make the file executable withchmod +x NAMEOFFILE
and then run./NAMEOFFILE
.