<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18812"></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=218212202-11092009><FONT color=#0000ff
size=2 face=Arial>As most know... my eyes play tricks on me... mostly in not
working at all, period... but I added the cnt(4,.0) variable to the wrong
example below. It obviously should be where the second declare of
nu_files(4,.0) is. I went bakc up and declared the cnt on the wrong
example stub, sorry. I'm hoping you can see that it belonged where I doubled
num_files by mistake.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=218212202-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=218212202-11092009><FONT size=2
face=Arial>Good luck</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=218212202-11092009></SPAN> </DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B>
filepro-list-bounces+john=valar.com@lists.celestial.com
[mailto:filepro-list-bounces+john=valar.com@lists.celestial.com] <B>On Behalf
Of </B>John Esak<BR><B>Sent:</B> Thursday, September 10, 2009 10:19
PM<BR><B>To:</B> 'Tyler'; filepro-list@lists.celestial.com<BR><B>Subject:</B>
RE: USER command questions<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT color=#0000ff
size=2 face=Arial>You are using the wrong filePro tool
entirely.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>I believe this could be written in about 5 lines of code if you
were to do it with the right processing. The user command is not in any
stretch the right function to use to do what you want to
accomplish.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>You sound frustrated at filePro for not being able to do something
simple. You haven't taken the time to find out how this should be
done. I suppose it is admirable that you at least tried something you
thought might work. However, when it didn't work, your bashing about on
filePro is disheartening.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>When you want to open a directory (folder) and do something to each
of the files you find therein, use the "opendir()
function.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>It has some special masks to show you only the specified filePro
format types of screens outputs, etc. But, its real value is just
specifying some wildcard to retrieve only the exact files you want. You
could specify "*" and get every file in a directory (in which case you will
also get the . and .. entrires, so you have to be aware of this and skip over
them with a test. But essentially, to use opendir() you do it like
this:</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then: declare num_files(4,.0), cnt(4,.0);
cnt="1" </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then:
num_files=opendir("*","/tmp/path/to/dir")</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>After the the line with the opendir() is exectured, the system
maintained arrays @dirlist, @dirlist_filename and @dirlist_name and
@dirlist_ext are filled immediately with all the filenames (and
dirnames) found in that wildcard search of the specified folder. In this
case "*" (it could be "*.txt" or "*.csv" and so on, then you would only
get that wildcarded group of files thrown into the @dirlist arrays.) It
is important to note that the opendir() command works like all the other file
I?O commands in that it returns a value to the variable on the left side of
the operation. So, not only are these arrays filled with the file and
directory names found by the wild card filter, but the total number of them is
stored into the variable you put in the opendir() command. In my example
num_files. (Check the manual for what @dirlist_filename/name/ext each actually
hold. It is clearly laid out there.)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>This is extremely useful because you can start a counter like I'm
showing above, and point to each file found in the directory until you reach
the total number of files found by the search... then you end the operation
and move on. In other words when cnt goes one higher than num_files, you
are done.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>So, you will be saying something like the following. It will
be somewhat stylized, I haven't looked closely at your code, and don't have
time to code exadctly what you need... but you can modify the code I"ll write
now in about 3 minutes to do just what you need done. Here I go, I'm
timing myself....</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial><GET_TIME></FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then: declare
num_files(4,.0), num_files(4,.0); cnt="1"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then:
num_files=opendir("*","/some/path/to/a/folder")</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>loop if: cnt gt
num_files</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then:
num_files=closedir(); return (or go somewher else)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>
if: @dirlist_filename[..] eq "." or @dirlist_filename [cnt] eq
".."</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then: cnt=cnt + "1";
goto loop</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> if:
@dirlist_filename[cnt] eq "something you want" to
move"</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then: declare SysCmd;
SysCmd="mv" < @dirlist_filename[cnt] the_other_place_and_name {
""</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then: system
SysCmd</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> then: cnt=cnt + "1";
goto loop</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></GET_TIME> Just about 1 minute 30
seconds.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>So, you see, it is not so difficult to do a simple job in filePro
if you use the right tool.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>Good luck,</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>John Esak</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial>P.S. Tyler, please note the num_files=closedir() it is
very important to close the opening of the directory when you're done.
You may want to open another folder and you would not be able to do it unless
you execute the closedir(). Do it without arguments and into any
variable... why not the one that was used to hold the total number of found
files.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=578314501-11092009><FONT size=2
face=Arial> </FONT></SPAN></DIV><BR>
<BLOCKQUOTE
style="BORDER-LEFT: #0000ff 2px solid; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<DIV dir=ltr lang=en-us class=OutlookMessageHeader align=left>
<HR tabIndex=-1>
<FONT size=2 face=Tahoma><B>From:</B>
filepro-list-bounces+john=valar.com@lists.celestial.com
[mailto:filepro-list-bounces+john=valar.com@lists.celestial.com] <B>On
Behalf Of </B>Tyler<BR><B>Sent:</B> Thursday, September 10, 2009 8:33
PM<BR><B>To:</B> filepro-list@lists.celestial.com<BR><B>Subject:</B> USER
command questions<BR></FONT><BR></DIV>
<DIV></DIV>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.<BR><BR>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!
<BR><BR>Here is what I have:<BR><BR>::DECLARE filepath(128,*);
filepath="/public/mailerListsSent/Prospects/":<BR>::DECLARE
filename(32,*):<BR>::debug on:<BR>::USER dirlist = ls:<BR>::USER move =
mv:<BR>::dirlist=filepath{"/*.csv"; filename=dirlist:<BR>loop01s:filename eq
"":goto loop01e:<BR>::show filename:<BR>::'msgbox
filepath{filename<filepath{"imported/"{filename:<BR>::'goto
loop01n:<BR>::move = "-f":<BR>::move = filepath{filename:<BR>::move =
filepath{"imported/"{filename:<BR>::i=move:<BR>::end:<BR>loop01n::filename=dirlist;
goto loop01s:<BR>loop01e:::<BR><BR>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?<BR></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>