Transferring multiple files from one folder to another using Terminal

Solution 1:

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).

cd "PATH/TO/Paras_all"
count=0
find . -maxdepth 1 -iname '*.png' -print | while IFS= read line; do
    if [[ $count -lt 5000 ]]; then
        echo cp "$line" ~/"Documents/TARGET1"
    elif [[ $count -lt 10000 ]]; then
        echo cp "$line" ~/"Documents/TARGET2"
    else
        echo cp "$line" ~/"Documents/TARGET3"
    fi
    ((count++))
done

Replace -name '*.JPG' to mach your images and TARGET1 etc by the actual names. If you run the code like that it will just print the commands. Remove the echo 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 with chmod +x NAMEOFFILE and then run ./NAMEOFFILE.

Solution 2:

you can first go to Finder and open the folder with all the images. I would select all the files and right-click. One of the options you'll see when you right-click is to Rename 13000 files. If you click on this option you'll get a pane where you can rename the files in sequential order. You can define the first part of the name and it will add the sequential part.

Now create a folder for the first 5000 files. You can just select the first 5000 files and and create a shell script that runs from 1 to 5000 and run it from the new empty folder. The command that sets run 5000 times is, from the new directory, "cp ../old_folder_name/files_name_inum *".This will copy files *_00001 to *_05000 to you first new directory. Then make a 2nd directory and have you script run from *_05001 to *_10000 and finally run a third time to get the files 10001 to 13000.

The actual unix shell script is the following

for i in {0001..5000}
do
   cp ../old_imager_files/image_files_$i target1/
done