[Chicago-talk] Merging two dir's into a third

Steven Lembark lembark at wrkhors.com
Wed Feb 18 13:30:13 CST 2004


> dira/apple/this.txt
> and
> dirb/apple/that.txt
>
> and end up with
>
> dirc/apple/this.txt
> dirc/apple/that.txt

	for i in $dira $dirb;
	do
		( cd $i; find . | cpio -pdv $dirc )
	done

You could use File::Find::finddepth and a with a mkdir
or rename but cpio is going to handle all of the types
properly (and exits nonzero if the filesystem gets full,
which tar won't).

enjoi

--
Steven Lembark                               2930 W. Palmer
Workhorse Computing                       Chicago, IL 60647
                                            +1 888 359 3508



More information about the Chicago-talk mailing list