Tom,

I create a temp table and load it with, in my case folder names:

DROP TABLE `Temp_Data_Load`
CREATE TEMP TABLE `Temp_Data_Load` +
(Directory_Date TEXT (10), +
Directory_Time TEXT ( 5), +
Directory_Ind TEXT ( 5), +
PrevBackUp_Name TEXT (30) )


Get the folders into a file:

OUTPUT D:\DBFiles\BackUp\BUDir.BAT
WRITE '@ECHO OFF'
WRITE 'DIR', .vBackUpPath , '/-P /O:D /A:D /-C > D:\DBFiles\BackUp\BUDir.FLE'
WRITE 'EXIT'
OUTPUT SCREEN
LAUNCH D:\DBFiles\BackUp\BUDir.BAT


Load the data into the temp table:

LOAD `Temp_Data_Load` FROM BUDir.FLE AS FORMATTED USING +
Directory_Date 1 10, +
Directory_Time 13 17, +
Directory_Ind 22 26, +
PrevBackUp_Name 37 67


Remove unwanted rows:

DELETE ROWS FROM `Temp_Data_Load` WHERE PrevBackUp_Name IS NULL
DELETE ROWS FROM `Temp_Data_Load` WHERE PrevBackUp_Name NOT LIKE '201%'


You then have a choice of what to do with the data. I pop up a menu to select from:

CHOOSE vChoose FROM #VALUES FOR PrevBackUp_Name FROM Temp_Data_Load +
ORDER BY PrevBackUp_Name ASC


You can automatically pick the oldest or newest – max or min date – or use it however you want.

Regards,
Alastair.




From: TOM HART
Sent: Sunday, January 23, 2011 7:56 PM
To: RBASE-L Mailing List
Subject: [RBASE-L] - Capturing date from a file

I want to capture a file into a variable by the date. I have numerous bkp and lob files in a directory and want the last backup so I can automatically restore the database. I do this manually now but want to automate. Tom Hart
--- RBASE-L
================================================
TO POST A MESSAGE TO ALL MEMBERS:
Send a plain text email to [email protected]

(Don't use any of these words as your Subject:
INTRO, SUBSCRIBE, UNSUBSCRIBE, SEARCH,
REMOVE, SUSPEND, RESUME, DIGEST, RESEND, HELP)
================================================
TO SEE MESSAGE POSTING GUIDELINES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: INTRO
================================================
TO UNSUBSCRIBE: Send a plain text email to [email protected]
In the message SUBJECT, put just one word: UNSUBSCRIBE
================================================
TO SEARCH ARCHIVES:
Send a plain text email to [email protected]
In the message SUBJECT, put just one word: SEARCH-n
(where n is the number of days). In the message body, place any text to search for.
================================================


Reply via email to