[X-Unix] cp question

Doug McNutt douglist at macnauchtan.com
Thu Feb 24 16:33:07 PST 2005


At 16:01 -0600 2/24/05, Russell McGaha wrote:
>Folks;
>  I've got a question about how to only copy certain files of a folder [more accurately to not copy].
>  I've a 10.2.8 system [so I'll be using tsch] that I need to copy the files in one director to another directory; this is no problem, BUT I need to EXCLUDE a couple of files

Try this. Replace the echos with your copy commands. Do you want cpMac for the resources? The current directory needs to be your starting point.

#!/bin/tcsh
#  arguments are files not to be copied
foreach fff (*)
	set flag = 0
	set nnn = ${#argv}
	while ($nnn > 0)
		if ("$fff" =~ "$argv[$nnn]") then
			set flag = 1
		endif
		@ nnn--
	end
	if ($flag == 0) then
		echo "yes $fff"
	else
		echo "not $fff"
	endif
end

And. . .

I did it wrong and left out the space after the @ sign. The result was a process that simply could not be killed, even by the superuser and even with -9. Software restart resulted in a kernel panic that did not terminate for over 5 minutes. Hardware restart fixed it. I thought such things were impossible in OS neXt!

I also tried it with a foreach ($argv) and had intractable problems with file names (as arguments) containing spaces.


-- 

--> From the U S of A, the only socialist country that refuses to admit it. <--


More information about the X-Unix mailing list