List Info

Thread: Re: Problem Getting File Name from result of dir *.sql




Re: Problem Getting File Name from result of dir *.sql
country flaguser name
Czech Republic
2007-03-19 09:29:13

From: "sailorpat2"; < pat.hall%40gilbarco.com">pat.hallgilbarco.com>
> Can't figure out why the following code will not give me the file
> name correctly.
>
> open (FH,">>process.txt&quot;);
&gt; print FH "[$timestamp] $directory.nn";
> close (FH);
&gt; backup_files=`dir $directory\*.sql >q_backups.txt`;
> #print "dir $directory\*.sql >q_backups.txtn&quot;;
>; open(FH,"q_backups.txt&quot;);
&gt; backup_files=<FH&gt;;
> close(FH);

backup_files = glob "$directory*.sql";

There is no need to execute anything external, you can get the list
easier from within Perl. Plus if you did want to use dir you should
do it like this:

backup_files=`dir $directory\*.sql`;

there is no need to redirect the output only to read it afterwards.

Jenda
===== Jenda%40Krynicky.cz">JendaKrynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )