USER command questions

Fairlight fairlite at fairlite.com
Thu Sep 10 18:34:45 PDT 2009


Y'all catch dis heeyah?  Tyler been jivin' 'bout like:
> Has anyone managed to get his to work on SCO Openserver with the mv or cp
> commands?  I can get ls to work, but no matter what I try I get the command
> usage output to std err.  These are such basic commands I can't believe they
> wouldn't work for USER as it is described in the manual.
> 
> All I really want is to list the csv files in a directory, process them,
> then move them to another directory.  This extremely basic file manipulation
> to be ridiculous difficult to do in filePro!
> 
> Here is what I have:
> 
> ::DECLARE filepath(128,*); filepath="/public/mailerListsSent/Prospects/":
> ::DECLARE filename(32,*):
> ::debug on:
> ::USER dirlist = ls:
> ::USER move = mv:
> ::dirlist=filepath{"/*.csv"; filename=dirlist:
> loop01s:filename eq "":goto loop01e:
> ::show filename:
> ::'msgbox filepath{filename<filepath{"imported/"{filename:
> ::'goto loop01n:
> ::move = "-f":
> ::move = filepath{filename:
> ::move = filepath{"imported/"{filename:
> ::i=move:
> ::end:
> loop01n::filename=dirlist; goto loop01s:
> loop01e:::
> 
> Can anyone tell me how to use cp or mv with the USER command?  Or is it just
> garbage and I should go back to SYSTEM?

You're assigning the 'move' "alias" (ie., USER handle or whatever the
proper fP parlance for it is) first, there.  And then you're essentially
piping in arguments to it, rather than having them all as one command.

In shell terms, what you're doing is essentially the same as:

$ mv <<END
> -f
> /some/path
END

That's why 'mv' is bailing on you.  It's not meant to be used that way.

Forget using USER for 'mv'.  It's nothing you get interactive feedback
from, so USER is overkill.  Assemble the entire command with arguments and
feed it to SYSTEM for each file.

Also, be VERY careful with dirlist.  It has a filename length limitation
that will bite you if the filenames are longer than the memory allocated to
the function's memory storage.

Back to the original:  Only use USER when you require interactive feedback
from and/or interactive data supply to a process.  Neither 'mv' nor 'cp'
fall into that category.

mark->
-- 
Audio panton, cogito singularis,


More information about the Filepro-list mailing list