On 24-Sep-99, Don Cox wrote:

> It seems people do want. Just remove the unwanted bits in a text
editor. The mailing list eats attachments.

/* Program to list versions of files. Files with no version strings will give error 
messages.*/

/* $VER: VersionLister April 11 99 */
/*call open("STDERR","ram:traceVL","W")
trace r*/


address command
dir1 = getclip('VersionListIn')
if dir1 ~= "" then 'requestfile >ram:answer DRAWER "'dir1'" TITLE "Source Directory" 
DRAWERSONLY'
else 'requestfile >ram:answer TITLE "Source Directory" DRAWERSONLY'
call open("answer","ram:answer",'R')
directory = strip(readln("answer"),'B','"')
call setclip('VersionListIn',directory)
if directory = "" then exit

outfile = getclip('VersionListOut')
if outfile~="" then 'requestfile >ram:answer2 TITLE "Destination File" '
else 'requestfile >ram:answer2 TITLE "Destination File" '
call open("answer2","ram:answer2",'R')
OutFile = strip(readln("answer2"),'B','"')
call setclip('VersionListOut',OutFile)
if outfile = "" then exit
call open("outlist",outfile,'W') /* Create the file */
call close("outlist")

'requestchoice >ram:rcnum6 "Subdirectories" "Also list files from Subdirectories?" 
"Yes|No|Abort"'
call open("answer6","ram:rcnum6")
rcn = readln("answer6")
Subdirs = 0
if rcn = 0 then exit
if rcn = 1 then subdirs = 1

call open('infocon', 'con:10/0/600/90/"VersionLister"')


/* List files in one directory and its descendents */

filecount = 1
address command
'resident c:delete pure'
'delete ram:dirlist1'
'delete ram:dirlist'
'list >ram:dirlist1 "'directory'" dirs all LFORMAT="%P%S"'
'sort from ram:dirlist1 to ram:dirlist'
if ~open("dirinput","ram:dirlist","r") then subdirs = 0

/* First List files in root directory */
call dirList(directory)

if subdirs = 0 then exit 0

/* Now do all the subdirectories */

listtest = readln("dirinput")
if listtest = "" then exit
call seek("dirinput",0,'B')

do d = 1 to 700
    directory2 = readln("dirinput")
    if directory2 = ": bad template" then iterate d
    if directory2 = "" then break
    call dirList(directory2)
    end

call close('infocon')
exit 0

/* +++++++++++++++++++++++++++  ++++++++++++++++++++++++++++++++++++++++ */

/* List versions of all the files in a directory */

dirList:
parse arg dirname
address command
'delete ram:filelist1'
'delete ram:filelist'
'list >ram:filelist1 "'dirname'" files LFORMAT="%P%S"'
call open('input',"ram:filelist1","r") /* test in case it's empty */
listtest = readln('input')
call close('input')

if listtest~="" then do
    'resident c:version pure'
    'sort from ram:filelist1 to ram:filelist'
    call open('input2',"ram:filelist","r")
    do i = 1 to 7000   /* safety limit of 7000 files  */
        filename = readln('input2')
        if filename = "" then break
    
        slashpos = lastpos("/",filename)
        dotpos = lastpos(".",filename)
        if dotpos<slashpos then dotpos = 0 /* not dots in directory names */
        if dotpos~=0 then extension = substr(filename,dotpos)
        else extension = ""
        extensionU = upper(extension)
        if extensionU = ".INFO" then iterate i
        if extensionU = ".TYPE" then iterate i
        if extensionU = ".GIF" then iterate i
        if word(filename,2) = "files" then iterate /* This line not a file name */
        if word(filename,1) = "TOTAL:" then iterate  /* or this one */
        if verify(filename,"*()",'m')~=0 then iterate /* dos can't handle these chars 
*/

        call open("testinput",filename,"R")
        chunks = readch("testinput",300)
        call close("testinput")
        if chunks = "" then iterate i /* empty file */
        chunks2 = left(chunks,12)
        if pos("JFIF",chunks2)~=0 then iterate i /* JPEG image */
        if pos("FORM",chunks2)~=0 then iterate i /* IFF file */

        'failat 20'
        'version >ram:vvv 'filename
        call open("answer8","ram:vvv")
        rcn = readln("answer8")
        call close("answer8")
        if word(rcn, 1)="Could" then iterate i /* skip error messages */
        infomessage = filename"    "rcn
        call writeln('infocon',infomessage)
        call open("outlist",outfile,'A')
        call writeln("outlist", infomessage)
        call close("outlist")

    end /* i= 1 to 7000 */
call close('input2')
end

return

exit 0



/* ++++++++++++++++++++++++++++ ++++++++++++++++++++++++++++++++ */



getpath:
parse arg allname
pos1 = lastpos("/",allname)
if pos1 = 0 then pos1 = lastpos(":",allname)
filepath = left(allname,pos1)
return filepath

getname:
parse arg allname
pos1 = lastpos("/",allname)
if pos1 = 0 then pos1 = lastpos(":",allname)
justname = substr(allname,pos1+1)
return justname 

expandfilename: procedure
  parse arg jfile;
  if index(jfile,':') = 0 then do
    curdir = pragma(D);
    if right(curdir,1) ~= ':' then do
      if right(curdir,1) ~= '/' then do
        if curdir ~= '' then do
          curdir = curdir || '/';
          end;
        end;
      end;
    jfile = curdir||jfile;
    end;
  return jfile


/* +++++++++++++++++++++++++++++ +++++++++++++++++++++++++++++++ */











Regards
-- 
Don Cox
[EMAIL PROTECTED]

____________________________________________________________
Voyager Mailing List - Info & Archive: http://www.vapor.com/
For Listserver Help: <[EMAIL PROTECTED]>, "HELP"
To Unsubscribe: <[EMAIL PROTECTED]>, "UNSUBSCRIBE"

Reply via email to