[X-Unix] shell scripting

Bert Knabe bknabe at mac.com
Thu Jan 15 19:21:28 PST 2004


On Jan 15, 2004, at 9:02 PM, Doug McNutt wrote:

> At 20:34 -0600 1/15/04, Bert Knabe wrote:
>> I have a relatively simple task, but little programming knowledge. I 
>> need to have a folder checked and files copied to another folder. I 
>> originally planned to do this in Applescript, but Applescript has 
>> proven less than effective.
>
> I'd like to know more about conditions in which folder actions are 
> unreliable. The only thing I have had any problem with is getting the 
> action to occur when the file is not dragged to a folder using the 
> finder but is placed there by a running application other than Finder.

The files are being saved to it by another application over the 
network, but that's pretty much the problem. But it was explained to me 
(on the Apple Applescript list!) as "Folder Actions disable themselves 
for no reason". And for a while that seemed to be the problem - using 
Script Timer to reenable Folder Actions worked - for about 2 days. Then 
I saved the Enable Folder Actions script as an Application, and set a 
cron job, and that worked for about 2 days. But anything I've done that 
fixes the folder actions seems to work for about 2 days at most.

>> I need to either have a folder watched, and when new files are added, 
>> copy them to another folder on a different volume, or have the folder 
>> checked every so often and files added since the last check copied to 
>> another folder on a different volume.
>
> It should be straightforward to create a shell executable - x 
> permission bit set - that runs as a cron job (man cron) every half 
> hour. It can check modification dates of files in the source and 
> destination folder and make copies as required.  If the files have Mac 
> resource forks, or if Mac Finder info is important 
> ,/Developer/Tools/CpMac is needed as opposed to a UNIX cp which pays 
> attention only to the data fork.

Yes, I need to keep the OS 9 Meta Data. I'm glad you mentioned that, 
because I had already forgotten that shells don't see it.
>
> -- 
> -->  There are 10 kinds of people:  those who understand binary, and 
> those who don't <--

I love this tag. :)

Bert



More information about the X-Unix mailing list