Vb wrote:
What I'm trying to do is to create a program that reads through a
certain directory and outputs the location of each file(both in the
directory and subdirectorys) into a text file. I am completely new to
Perl and under a time restriction so any help would be greatly
appreciated...thanks in advance

I create the following script:

[code]
use strict;
use File::Find;

sub eachFile {

 my $filename = $_;

 my $fullpath = $File::Find::name;

 #remember that File::Find changes your CWD,

 #so you can call open with just $_


  if (-e $filename) {

File::Find (and any programming language in general) queries the operating system for the file names in the file system so if you are provided a file name from the operating system it must therefore exist and subsequently testing for its existence is superfluous. (The operating system does not just make up random file names out of thin air.)

  print "$filename exists!"

     . " The full name is $fullpath\n";

  }
}

find (\&eachFile, "mydir/");

[/code]

Is this correct?

It looks correct as far as I can see.

Additionally I wanted the script to run on an hourly
basis to reupdate...how is this possible?

Perhaps your operating system provides a program like 'cron' or 'at' that lets you run your program at scheduled intervals.

man cron
man at

If you really want to do it in Perl please let us know.



John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to