FileSelection

Hi all!

Is there an easy way to get a fileselector where one can select multiple files at once? PtFileSelection() allows only one file to be selected/returned.

Regards,
Markus Poellmann

You may want to try another approach when dealing with files. Often
when dealing with files, I like to shell out with a system command.

You can either build the command(s) needed or call a script with the
system() function.
Ex:
sprintf( buffer, “ls %s > %s”, fileFilter, resultFile );
system( buffer );

or

sprintf( “myscript” );

When you build your own command string, if you also use commands like
sed & xargs, you can create quite powerful functions. In the first
example, after running the command, just read the output file line by
line to get your list of files.

You can write short programs (or shell scripts ) that take in from
stdin a filename that then process that file.
Ex:
“ls %s | %s”, fileFilter, programToRun );

I created an email system that looks for “ready” files and then sends
them from the command line using sendmail. Files were ready when in an
output directory there was a “filename” and a “filename.ok” file.

ls outbox/*ok | sed “s/.ok$//” | xargs –i SENDIT {}

  • This finds all of the files that end in .ok,
  • strips off .ok using sed to get the base file name,
  • repetitively calls script SENDIT with each base file name.
  • The SENDIT script calls sendmail and then moved the files to a
    sentbox or errbox directory depending on email results.

I know some of the purists say that this is inefficient, but my time is
more important than the processor’s time and if it takes 2 eye blinks
to run instead of 1, who cares, when I can write something in minutes.

Good luck

Vince



In article <Voyager.010122213102.5902366B@Verleihnix.Gallien.de>,
Markus Poellmann <poellman@talknet.de> wrote:

Hi all!

Is there an easy way to get a fileselector where one can select
multiple files at once? PtFileSelection() allows only one file to be

selected/returned.

Regards,
Markus Poellmann

Sent via Deja.com
http://www.deja.com/