Example Extractor Script for Windows

The following illustrates the DIR.EXT script file which is one of the default scripts included.

! DIR.EXT
! Extractor script to process output of DIR /-C
! (/-C outputs filesizes without the , between thousands)
!
! Output of DIR /-C looks like:
!
! Volume in drive C has no label.
! Volume Serial Number is 0836-7CF1
!
! Directory of c:\
!
!10/22/08 11:35a <DIR> WINNT
!10/22/08 11:38a <DIR> Program Files
!10/22/08 11:41a 0 CONFIG.SYS
!10/22/08 11:41a 0 AUTOEXEC.BAT
!02/26/09 08:49a 145752064 pagefile.sys
!02/23/09 02:28p 6194 DEBUG.TXT
!10/30/08 10:43a <DIR> Multimedia Files
! 9 File(s) 145758258 bytes
! 11337728 bytes free

RECORD DIR
FILETYPE TEXT

delimiters ""
! Skip the header details
skiplines 5
oneol startline
label startline

! Test for trailer details-it starts with a blank- exit if found if " " end

! Set modification time. Note e for AM/PM indicator for non-24-hour time.
! Set mtime using "MM/DD/YY hh:mme"

skipbytes 1
skipwhitespace

! Test if the file is a directory
if "<DIR>" directory

label getsizeandname
   set size
   skipwhitespace
   set filename
   goto nextline

label directory
   set type = "[DIR]"
   skipbytes 5
   skipwhitespace
   set filename
   ! full thru to nextline

label nextline
   deliverrecord
   skiplines 1

label end
exit
Provide feedback on this article