opendir() and @dirlist()
Enrique Arredondo
henry at vegena.net
Wed Nov 16 14:59:50 PST 2005
----- Original Message -----
From: "Bob Stockler" <bob at trebor.iglou.com>
To: "Fplist (E-mail)" <filepro-list at seaslug.org>
Sent: Tuesday, November 15, 2005 11:53 AM
Subject: Re: opendir() and @dirlist()
> Enrique Arredondo wrote (on Tue, Nov 15, 2005 at 11:00:41AM -0800):
>
> | As well as folder names greater than 32 are omited. This really sucks.
> If
> | it was just 100 files I was dealing with wouldn't be a major disaster
> but I
> | have thousands of files which are generated using an automated system
> | that's running on the fly and all of this ends up in a web "document
> | management system" page. This is what happens when you want to use
> filepro
> | for everything.
> | Anyway I'll try the "ls > file" option suggested by Bob Stockler
> meanwhile
> | I'll pray to all the Gods of the Cosmos so that filepro tech support
> | accepts the need to increment the size from 32 to match the OS and
> delivers
> | a quick new revision of *clerk. In less than 1 week ???
>
> Henry, don't count on it. The 32 length filename limitation is a
> result of these routines being written for the express purpose of
> working with filePro files (whose names have a maximum 32 character
> length), and not as generalized tools.
>
> But filePro has provided other tools, as I suggested, that will work
> (and I think are easier to use). As it happens, I had a few minutes
> to play around with it this morning, and wrote this to demonstrate:
>
> @MENU If:
> 1 Then: dim Array[32000] ' assure enough elements for the number of
> files
> 2 Then: gosub DoIt
> 3 Then: Cnt = listbox(Array,"1",Cnt1) ' Processing of files goes here
> 4 Then: exit
> DoIt If:
> 5 Then: Cwd = getcwd()
> 6 Then: Target_Dir = getenv["Target_Directory"] ' or assign target
> directory
> 7 Then: chdir Target_Dir
> DOS If: @os eq "DOS"
> 8 Then: List_Cmd = "dir /b" ; Temp = "C:\temp\files.tmp"
> NIX If: NOT DOS
> 9 Then: List_Cmd = "ls" ; Temp = "/tmp/files.tmp"
> 10 Then: system noredraw List_Cmd < ">" < Temp
> 11 Then: Handle = open(Temp,"tr") ; Cnt1 = "1"
> If: Handle lt "0"
> 12 Then: goto Done
> GetName If:
> 13 Then: Cnt = readline(Handle,Misc,"256") ; Array[Cnt1] = Misc
> If: Misc gt ""
> 14 Then: Cnt1 = Cnt1 + "1" ; goto GetName
> 15 Then: Cnt = close(Handle) ; Cnt = remove(Temp) ; chdir Cwd ; return
> Done If:
> 16 Then: errorbox "\n Could not open the file" < Temp { ". \n " ; exit
> 17 Then: declare Cnt(8,.0) ; declare Cnt1(8,.0) ; declare Cwd ; declare
> Handle(8,.0)
> 18 Then: declare List_Cmd ; declare Misc ; declare Target_Dir ; declare
> Temp
>
> And here's the processing table you can easily try out:
>
> @MENU::dim Array[32000] ' assure enough elements for the number of files:
> ::gosub DoIt:
> ::Cnt = listbox(Array,"1",Cnt1) ' Processing of files goes here:
> ::exit:
> DoIt::Cwd = getcwd():
> ::Target_Dir = getenv["Target_Directory"] ' or assign target directory:
> ::chdir Target_Dir:
> DOS:@os eq "DOS":List_Cmd = "dir /b" ; Temp = "C\temp\files.tmp":
> NIX:NOT DOS:List_Cmd = "ls" ; Temp = "/tmp/files.tmp":
> ::system noredraw List_Cmd < ">" < Temp:
> ::Handle = open(Temp,"tr") ; Cnt1 = "1":
> :Handle lt "0":goto Done:
> GetName::Cnt = readline(Handle,Misc,"256") ; Array[Cnt1] = Misc:
> :Misc gt "":Cnt1 = Cnt1 + "1" ; goto GetName:
> ::Cnt = close(Handle) ; Cnt = remove(Temp) ; chdir Cwd ; return:
> Done::errorbox "\n Could not open the file" < Temp { ". \n " ; exit:
> ::declare Cnt(8,.0) ; declare Cnt1(8,.0) ; declare Cwd ; declare
> Handle(8,.0):
> ::declare List_Cmd ; declare Misc ; declare Target_Dir ; declare Temp:
>
> If you cut and paste it, change the ^A's (<Caret>+A's) in
> it to <Ctrl>+A.
>
> If you have filenames longer than 256 characters, change the
> 256 in line 13 to whatever is required to accomodate them.
>
> Put it in any filePro File directory, edit it to point to a
> directory of interest, and execute:
>
> $PFPROG/fp/dclerk fPfilename -sAnyScreen -y '' -z tablename
>
> and try it out (and let me know how you like it).
>
> It should work on Windows, but was tested only on UNIX.
>
> Bob
>
> --
Very Nice!!! , It shows all of the files no matter the size! even
directories.
Now I'll try to incorporate in my processing table and see how it behaves
launched from a Webpage/cgi script.
Thanks so much for taking the time writing it!
More information about the Filepro-list
mailing list