1. Create a one time BAT file. say SORTFILE.BAT

DIR /A-D /4 /ODNE *.PDF | FIND "/" > %1


2. This will create a directory listing of only date, time, [am|pm], filesize 
(with commas), filename
    this will be directed to filename passed as parameter
3. Create a .RMD file or better still, once debugged, a STORED PROCEDURE
    set var tempfile text = (FILENAME(0))
    CREATE TEMP TABLE tempdirlist (+
    columndefintionsofabovedirlist
     )
 -- if you wish you could include column to AUTONUM

LAUNCH 'SORTFILE.BAT|&TEMPFILE|W'
LOAD tempdirlist from &TEMPFILE AS FORMATTED USING colname start end, colname 
start end..
-- do any cleanup and insert into permanent file for your users to process
-- note no need to sort file info after loading into rbase as command line DIR 
has done that for you
ERASE .TEMPFILE -- get rid of temp dir file created by command line DIR bat file


Please note that I  have not fully tested this and you may have to experiment 
with my code.

The object of the game is to use the Windows command line to create a sorted 
directory list via the LAUNCH RBase command
Directory information is loaded into a temporary RBase Table using the LOAD AS 
FORMATTED syntax.
Once the clean up functions are defined and coded the entire process can be a 
MENU driven command of CALLED as a STORED PROCEDURE.

Jim Bentley
American Celiac Society
[email protected]
tel: 1-504-737-3293


>________________________________
> From: Michael J. Sinclair <[email protected]>
>To: RBASE-L Mailing List <[email protected]> 
>Sent: Sunday, March 18, 2012 9:08 PM
>Subject: [RBASE-L] - Re: What is the best way to autonumber a column for 
>sorting?
> 
>
>Larry,
>That is an excellent question. Perhaps I can describe what I am doing, and 
>then the list can give me a better idea on how to do it.
>I have a few hundred thousand PDF files that are being created from a scanner. 
> 
>For the most part, we are scanning oldler documents first. All the scans go 
>into a single shared folder. Although the files might be from 2005, the file 
>date, created by the scanning program is the date of the scan, ie the date the 
>paper was turned into a PDF. So, more or less, older files have older file 
>dates. 
> 
>To get the names of the files into Rbase, I have to capture the output of the 
>DIR command. As you know, the Rbase version of the DIR command does not 
>support any sorting.
> 
>So, I load the data from the output of the DIR command into a table.
>I extract the file name, file size, file date, file time for each row of data, 
>ie 1 row per PDF file.
> 
>Now I want my app to show me the oldest file first, and move it to a folder 
>that makes sense in our office. I would like to imagine that the most recent 
>files end up "On Top of Pile" in each folder. I call that the MROT system, 
>(Most Recent On Top). Same as the organization on my desk.
> 
>So now I have to find the oldest file in the table based on the file date and 
>the file time. Since many of these files were created on the same date by the 
>scanner, I can't just ask for the minimum date. I need to look at the minimum 
>time within the minimum date. And if the scanner was working very quickly, 
>even the file times might be the same, so I use the name of the file which the 
>scanner creates for me....ie xxxx0001.pdf was scanned before (and is therefore 
>older) than xxxx0002.pdf
> 
>Now I could do a search for the lowest file date, and then the lowest file 
>time within that group of lowest file dates, and then the lowest filename 
>within the lowest file time...but that means 3 searches each time I move a 
>file from the scanned files folder to the destination folder. Not a bad 
>solution, but I was trying to be efficient. 
> 
>I tried using a cursor to go through the pile of files, but sometimes my girls 
>skip a few files because they are hard to read, or they don't know what is the 
>best folder to put them in. So I had to start flagging rows to indicate what 
>happened to them, ie skipped or filed. I have a next and previous button in 
>the app. The logic started giving me a headache if they skipped a few files, 
>then moved a few files, then went backwards a few files, etc. I also have an 
>"unfile" last button...which moves the file back from the destination folder 
>and into the unsorted folder. So now I have to unflag that row. I started 
>getting a really bad headache.
> 
>Further more, when we go back to look at the files, usually we want to look at 
>the last file that went into the folder first. To figure that out, I would 
>have to do a triple search, or set up a cursor and move through the pile of 
>files. Mentally, is is easier for me to wrap my brain around a single value in 
>a single column. Once the files are in their folder, they are renumbered, 
>starting with 1. If a file is ever deleted out of the middle of the pile, it 
>makes it easy to see...there will be a number missing.
> 
>So, my idea was to sort them just once by date, time and name, give them a 
>number starting with a 1, and then use the numbers to sort the files.
> 
>My solution is far from perfect, but it beats the heck out of file cabinets!!!
> 
>Mike
>
>
>From: Lawrence Lustig <[email protected]>
>To: RBASE-L Mailing List <[email protected]> 
>Sent: Sunday, March 18, 2012 8:41 PM
>Subject: [RBASE-L] - Re: What is the best way to autonumber a column for 
>sorting?
>
>
><<
>I have a table with a few thousand rows. The first column is an integer and 
>initially it has no data. That is the column I want to use to number my rows. 
>I want to put a 1 in the column for the row that has the lowest value for the 
>2nd, 3rd and 4th columns. They all have data that is easy to sort (date, time 
>and filename).
>
>>>
>
>
>Why do you need a proxy column if you can sort the data by the existing 
>columns?  What happens if the data in the underlying columns changes, should 
>the sort order column also change?
>--
>Larry
>
>
>
>

Reply via email to