can anyone script this for me?
I have dir1, dir2 and dir3 dir1/ +--- x.txt +--- y.txt +--- z.txt +--- xy.txt
dir2/ +--- x1.txt +--- y.txt +--- z.txt +--- x2y.txt
i want to move all files from dir1/ and dir2/ to dir3/ except the common files like y.txt and z.txt dir3 should contain
dir3/ +--- x1.txt +--- x2y.txt +--- x.txt +--- xy.txt
any command to do this?
Sometime on Nov 26, () Revant Nandgaonkar assembled some asciibets to say:
I have dir1, dir2 and dir3
[snip]
i want to move all files from dir1/ and dir2/ to dir3/ except the common files like y.txt and z.txt
cd dir1 for i in *; [ ! -e ../dir2/$i ] && mv $i ../dir3; done cd ../dir2 for i in *; [ ! -e ../dir1/$i ] && mv $i ../dir3; done cd ../dir3 ls
On Sun, 2005-11-27 at 00:13, Philip Tellis wrote:
cd dir1 for i in *; [ ! -e ../dir2/$i ] && mv $i ../dir3; done cd ../dir2 for i in *; [ ! -e ../dir1/$i ] && mv $i ../dir3; done cd ../dir3 ls
Shouldn't there be a do before the [ in each case?
Regards, NMK. ----------------------------------------------------------------------- The greatest love is a mother's, then a dog's, then a sweetheart's. -- Polish proverb