Thread: Re: Problem Getting File Name from result of dir *.sql
Re: Problem Getting File Name from
result of dir *.sql
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");
> print FH "[$timestamp] $directory.nn";
> close (FH);
> backup_files=`dir $directory\*.sql >q_backups.txt`;
> #print "dir $directory\*.sql >q_backups.txtn";
> open(FH,"q_backups.txt");
> backup_files=<FH>;
> 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