copying one type of file from many folders

find /src -regextype posix-extended -regex '.*(jpg|gif)' -exec cp {} /dest \;




pupit: tried

cp -r /d/d/*.file

but it doesnt work :/
Qwood: pupit: One second and I'll write you a one-liner here.
Qwood: pupit:

'for fname in $(find dir | grep .ext); do cp $fname newdir; done'

pupit: Qwood: awesome, thanks a lot :)
Qwood: pupit: dir being the top of the directory tree you want to copy from, ext being the file extension you are looking for, and newdir being the directory you want to copy to.
pupit: yeah :)
pupit: its clear to me
Qwood: pupit: I do that kind of copying all the time :)
pupit: its very handy :)
pupit: Qwood: i had a bit trouble copying from directories with spaces so i find this solution:

find /src -regextype posix-extended -regex '.*(jpg|gif)' -exec cp {} /dest \;

pupit: s/find/found
Qwood: pupit: I'm lucky to not have spaces in most of my files
pupit: Qwood: yeah, well when dealing with m$ users its inevitable :)
pupit: Qwood: i mostly use _ for space mark
Qwood: pupit: Same

Нема коментара:

Постави коментар