• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 191
  • Last Modified:

Find a file EASY!!!

I want to know how can I can verify if a  a specific file exists in a specific directory using Perl.
Thanks
0
Pampa
Asked:
Pampa
1 Solution
 
thoellriCommented:
See below - check also 'perldoc perlop'

Hope this helps
  Tobias


$specific_file="readme.txt";
$specific_directory="/my/home/directory";

# or Windows:
# $specific_directory="c:/MyFiles/xyz";

if (-e "$specific_directory/$specific_file") {
  print "File exists\n";
} else {
  print "File does not exist\n";
}
0

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now