[X-Unix] cp question

Russell McGaha RussellMcGaha at direcway.com
Fri Feb 25 07:55:03 PST 2005


Doug;
	Yes I use CpMac [see below]; could you annotate your script a little, 
I don't really understand what your doing nor how your doing it [at 
best, I'm still learning shell scripting] I've included what I'm 
currently using below.  It is the beginning of an self correcting 
series of scripts that will run on my [the one I administer] FileMaker 
Pro Server 5.5 Mac.
	ANY help, insight, or suggestions are welcome!
Russell
currently working script below

#!/bin/tcsh

set DayStr=`date +%A`;
set PathToFolder="/Volumes/Backup-HD/DailyBackups/"

switch ($DayStr)
     case "Monday":
set folder="Monday"
breaksw
  case "Tuesday":
set folder="Tuesday"
breaksw
  case "Wednesday":
set folder="Wednesday"
breaksw
  case "Thursday":
set folder="Thursday"
breaksw
  case "Friday":
set folder="Friday"
breaksw
      default:
echo "not Monday thru Friday"
exit
breaksw
endsw ;

echo ;
set folder=$folder-Evening;
set ArcFolder=$PathToFolder$folder

/Developer/Tools/CpMac -p $ArcFolder/* /BHC\ v5.5;

exit;

On Feb 24, 2005, at 6:33 PM, Doug McNutt wrote:

> 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. <--
> _______________________________________________
> X-Unix mailing list
> X-Unix at listserver.themacintoshguy.com
> http://listserver.themacintoshguy.com/mailman/listinfo/x-unix
>



More information about the X-Unix mailing list