2

I would like to copy range of jpg files from the multiple folders. I have a lot of folders with *.CR2 and *.xmp, in addition, it has a jpg folder with *.jpg files. I need to copy only jpg files and save file structure. example:

2018/folder1/jpg --> temp/folder1/jpg
2018/folder2/jpg --> temp/folder2/jpg

Can this be automated? not to go to every folder and copy the files? I tried Unix command: cp folder1/*.jpg to folder1/jpg and got *.jpg: no such file or directory

1

2 Answers 2

1

I would like to copy range of jpg files from the multiple folders. I have a lot of folders with *.CR2 and *.xmp, in addition, it has a jpg folder with *.jpg files. I need to copy only jpg files and save file structure. example:

2018/folder1/jpg --> temp/folder1/jpg
2018/folder2/jpg --> temp/folder2/jpg

If I understand correctly what you're asking...

You can change directory into the 2018 directory, e.g.:

cd "/path/to/2018"

Then use, e.g.:

rsync -aR */jpg ../temp/

This will copy the folder*/jpg directories in 2018 to temp so you'll have temp/folder*/jpg directories, where temp it at the same level as the 2018 directory.

In other words, as in your examples:

2018/folder1/jpg --> temp/folder1/jpg
2018/folder2/jpg --> temp/folder2/jpg

They will be created as you've shown.

-1

You can try going to temp folder and typing

cp -R ../2018/folder*/*.jpg .

and this should copy all jpg to temp but it won't copy folder1 to temp.

To copy folder1 and folder2 to temp again go to temp and type

cp -R 2018/folder* .

You must log in to answer this question.

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