[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: Directory Listings...
- Subject: Re: Directory Listings...
- From: "Sarabudla, Raji R." <Raji.R.Sarabudla@KP.ORG>
- Date: Mon, 23 Aug 1999 09:59:57 -0400
Hi Alex,
Command 'Dir' cannot execute at its own, unless it is in Dos Prompt Mode.
You need to run the system to 'Command' mode and then issue 'Dir' for
listing. I have accomplished this many times before. The following is
example may help you.
let $TempFileName = $Path || {TEMPFILE}
let $Command = 'DIR /B ' || $Path || $Filter || ' > ' || $TempFileName
!The getenv returns the Dos Command for the operating system. Ex: win-95
is 'Command', Win-NT 'Cmd'
let $runlisting = getenv('COMSPEC') || ' /c ' || $command
#debug display $Command
call system using $runlisting #Status wait
if #Status > 0
#debug display 'Could not perform directory listing'
#debug display #Status
end-if
HTH
Cheers,
raji
----------
From: Alex WOLLANGK [SMTP:alex_wollangk_at_doit-mail4@CCMAIL.ADP.WISC.EDU]
Sent: Friday, August 20, 1999 12:55 PM
To: Multiple recipients of list SQR-USERS
Subject: Directory Listings...
Greetings all,
I have a question. I am trying to pull flat files into a database,
but need to access some kind of a directory listing to find out which
files to pull. I searched through the SQR Server Language Reference
and didn't find anything that served this purpose directly. I then
had the novel idea to use a system call to redirect the directory
listing to a text file and open and parse that file to produce my
listing. The problem is that when my .sqr gets to the system call, it
doesn't do it and returns with a status of 2. Since anything less
than 32 indicates an error, this means I'm probably getting an error
from the operating system, but have no idea of where to find out what
this error is. I called the system using a variable to pass in the
command, so as a troubleshooting step I output the variable before
calling the system and have taken this output and copied and pasted it
into a command window and it works just peachy. I am just wondering
why I can't do from within an SQR system call what I can't from a
command prompt. I even tried creating a batch file which did the
directory listing and redirection and tried to just call that batch
file with the system call. No luck... It turns out that after
searching the Microsoft Knowledge Base, that a status of 2 indicates
that the 'DIR' command didn't find any files. I also found that the
'DIR' command returns an Error Code of 0 if it completes successfully.
I have also moved the files from the networked directory to my local
hard drive and to a share directory everyone has full access to, no
luck.
Anyone else have any ideas?
For reference, here's the code...
let $TempFileName = $Path || {TEMPFILE}
let $Command = 'DIR /B ' || $Path || $Filter || ' > ' ||
$TempFileName
#debug display $Command
call system using $Command #Status wait
if #Status > 0
#debug display 'Could not perform directory listing'
#debug display #Status
(where $Path is the DOS path, {TEMPFILE} is a file name, and $Filter
has been both *.* and *.ud* both with the same results)
Alex Wollangk