How to move files from a lot of folders into a single folder without moving the folders themselves?

apple.stackexchange https://apple.stackexchange.com/questions/393814

  •  28-05-2021
  •  | 
  •  

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
有帮助吗?

解决方案

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

其他提示

mv */*.jpg "High-Resolution Pics (Folder)"
mv *.jpg "Low-Resolution Pics (Folder)"

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.

许可以下: CC-BY-SA归因
不隶属于 apple.stackexchange
scroll top