akrrs7 has asked for the wisdom of the Perl Monks concerning the following question:
Only getting a single line output in the OutputFile and the results - size of file and date do not match Thanks...my $thisPath = cwd; my $inputFile = "${thisPath}${ps}inputFileInfo.txt"; my $pathToCheck = "c:${ps}temp"; my $outputFile = "${thisPath}${ps}resultsFile_$timestamp.txt"; open theInputFile, $inputFile or die "Could not read from $inputFi +le, program halting. \n"; while (<theInputFile>) { chomp; my $fileBeingChecked = "${pathToCheck}${ps}$_"; open (theOutputFile, '>', $outputFile) or die "Could not open +$outputFile. \n"; if (-e $fileBeingChecked) { my $fileSize = -s $fileBeingChecked; my $date_string = ctime(stat($fileBeingChecked)->mtime); print theOutputFile "Yes, $fileSize, $date_string \n"; } else { print theOutputFile "No \n"; } } close (theOutputFile) close (theInputFile)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Checking for Files
by RichardK (Parson) on Nov 18, 2011 at 13:47 UTC | |
by akrrs7 (Acolyte) on Nov 18, 2011 at 14:04 UTC | |
by aaron_baugher (Curate) on Nov 18, 2011 at 15:11 UTC | |
by akrrs7 (Acolyte) on Nov 18, 2011 at 14:13 UTC | |
by mbethke (Hermit) on Nov 18, 2011 at 16:47 UTC | |
|
Re: Checking for Files
by graff (Chancellor) on Nov 19, 2011 at 04:00 UTC |