2

Let's say I have the following files and folders.

High-Resolution Pics (Folder)
----WashingtonDC002.jpg
----WashingtonDC004.jpg

Low-Resolution Pics (Folder)
----WashingtonDC000.jpg
----WashingtonDC001.jpg
----WashingtonDC003.jpg

WashingtonDC005.jpg

WashingtonDC006 (Folder)
----WashingtonDC006.jpg
----UnimportantFile.txt

WashingtonDC007.jpg

WashingtonDC008.jpg

WashingtonDC009 (Folder)
----WashingtonDC009.jpg
----UnimportantFile.txt

I want to move all the images that are in the WashingtonDC folders into High Resolution Pics without taking all of the unimportant files along with it, and all the WashingtonDC images that aren't in WashingtonDC folders into Low-Resolution Pics. How would I go about doing this through the terminal?

This is what the final result would look like.

High-Resolution Pics (Folder)
----WashingtonDC002.jpg
----WashingtonDC004.jpg
----WashingtonDC006.jpg
----WashingtonDC009.jpg

Low-Resolution Pics (Folder)
----WashingtonDC000.jpg
----WashingtonDC001.jpg
----WashingtonDC003.jpg
----WashingtonDC005.jpg
----WashingtonDC007.jpg
----WashingtonDC008.jpg

3 Answers 3

3

This is what you're looking for ?

mv *.jpg Low-Resolution\ Pics/ Moves all '.jpg' files in current directory to low res folder.

mv WashingtonDC00*/*.jpg ./High-Resolution\ Pics/ Moves all '.jpg' files in folders beginning with 'WashingtonDC00' into High res folder.

Files before:

.
├── High-Resolution\ Pics
│   ├── WashingtonDC002.jpg
│   └── image0.jpg
├── Low-Resolution\ Pics
├── WashingtonDC005.jpg
├── WashingtonDC006
│   ├── WashingtonDC006.jpg
│   ├── WashingtonDC0061.jpg
│   ├── WashingtonDC007.jpg
│   ├── WashingtonDC008.jpg
│   └── rubbish.txt
├── WashingtonDC007.jpg
└── WashingtonDC009
    ├── WashingtonDC009.jpg
    └── rubbish.txt

Files after:

.
├── High-Resolution\ Pics
│   ├── WashingtonDC002.jpg
│   ├── WashingtonDC006.jpg
│   ├── WashingtonDC0061.jpg
│   ├── WashingtonDC007.jpg
│   ├── WashingtonDC008.jpg
│   ├── WashingtonDC009.jpg
│   └── image0.jpg
├── Low-Resolution\ Pics
│   ├── WashingtonDC005.jpg
│   └── WashingtonDC007.jpg
├── WashingtonDC006
│   └── rubbish.txt
└── WashingtonDC009
    └── rubbish.txt
0
mv */*.jpg "High-Resolution Pics (Folder)"
mv *.jpg "Low-Resolution Pics (Folder)"
0
-1

You can use the cp command on the terminal. cd to the folder you want to copy to. then type cp ../high_res_folder_name*.jpg * The other files you may have to do individually.

You can also just drag and drop using the finder.

1
  • why the downvote!
    – Natsfan
    Jun 14, 2020 at 3:17

You must log in to answer this question.

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