Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Copying certain subdirectories retaining structure



On Sat, 2014-02-22 at 20:06 +0000, zzapper wrote:
> I want to copy all files in subdirectories named /good/ to a USB while 
> retaining directory structure
> 
> /aaa/pic/good
> /aan/dogs/good/
> /dir1/dir2/dir3/good/

for i in **/good(/)
do
  dest=/media/usbkey/$i
  mkdir -p $i:h
  cp -a $i /media/usbkey/$i
done

Phil.



Messages sorted by: Reverse Date, Date, Thread, Author