Thom:

I wasn't sure if you received other answers on this but I will share my
technique.  Here is the code that I use to load new data into my database
each day.  Note that you will need to determine the exact format of the
results of a DIR command at the OS prompt, i.e. typing DIR so that you will
note which characters start where for file names, extensions, dates, etc.

Without further ado here's my code:

SET LINES 200  -- increases the line count so there are fewer breaks
--
OUTPUT filelist.txt APPEND -- directs that the results of following commands
will be placed in the filelist.txt file
--
DIR *.??t -- creates a list of files that have an extension ending in "t"
i.e. .txt, .dat, .srt, etc. in the default directory
--
OUTPUT SCREEN -- redirects output to the screen
--
CREATE TEMPORARY TABLE file_list (file_spec TEXT 45) -- creates a temporary
table to load the contents of filelist.txt into
--
CREATE TEMPORARY TABLE file_info (file_name TEXT 8,file_ext TEXT 3, +
file_size INTEGER,file_date DATE,file_time TIME) -- creates a temporary
table that allows for parsing the contents of the file_list table into
--
SET DATE MM-DD-YY -- sets the date format to OS date format
--
SET TIME FORMAT HH:MM:SS AP -- sets the time format to the OS time format
--
LOAD file_list FROM filelist.txt AS FORMATTED USING file_spec 1 45 -- loads
the file_list table with the contents of the filelist.txt file
--
INSERT INTO file_info * +
SELECT (SGET(file_spec,8,1)),(SGET(file_spec,3,10)),(SGET(file_spec,9,15)),
+
(SGET(file_spec,8,26)),(SGET(file_spec,5,36)) FROM file_list +
WHERE file_spec IS NOT NULL -- parses the contents of the file_list table
into the file_info table
--
SET TIME FORMAT HH:MM:SS -- sets the preferred R:Base time format
--
SET DATE MM/DD/YYYY -- sets the preferred R:Base date format
--
DELETE ROWS FROM file_info WHERE file_ext NOT IN ('dat','srt') +
OR file_date IS NULL -- deletes rows from file_info where the file_ext is
not a 'dat' or 'srt'
--

I am running this code under Windows 2000 and R:Base 6.5++ for Windows.

Hope this helps.

Mike Ramsour
Voice:  740-829-4340

-----Original Message-----
From: Thomas J Cimicato [mailto:[EMAIL PROTECTED]]
Sent: Friday, September 20, 2002 4:27 AM
To: [EMAIL PROTECTED]
Subject: Reading a directory


How would one go about creating a table of file names in a given directory?
I'm sure someone has done this before somehow.

Thom
Thomas J Cimicato
President
Integrated Check Technologies
Collect-A-Check, Inc.
------------------------------------------------------------
Bus:800.338.0676
Mailto:[EMAIL PROTECTED]
www.ICheckTech.com

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: INTRO rbase-l
================================================
TO UNSUBSCRIBE: send a plain text email to [EMAIL PROTECTED]
In the message body, put just two words: UNSUBSCRIBE rbase-l
================================================
TO SEARCH ARCHIVES:
http://www.mail-archive.com/rbase-l%40sonetmail.com/

Reply via email to