
smart000
New User
Sep 2, 2008, 8:19 PM
Post #1 of 2
(354 views)
|
|
a file exists progam
|
Can't Post
|
|
1. read a .txt file which lists file names (without dir path) to be checked 2. The files present in (1) should be present in the folder to be scanned 3. Have hardcoded variables to get a working version. The filename get displayed correctly, however the check fails. Thanks in advance. use strict; my $file_run_order = 'C:\Tech\perl_programs\check_files\IBA_BA_TEST\RUN_ORDER.txt'; my $work_dir = 'C:\Tech\perl_programs\check_files\IBA_BA_TEST\\'; my $file_to_check = "test"; my $all_well_flag = "1"; open(FILE,$file_run_order) || die "cannot open file !!"; chdir("C:\Tech\perl_programs\check_files\IBA_BA_TEST"); while(<FILE>){ my $file_to_check = $_; chomp($file_to_check); print ($file_to_check); print $work_dir.$file_to_check; if (-e "$work_dir.$file_to_check"){ #if (-e "$file_run_order"){ print " -- EXISTS \n"; } else{ print " -- NOT present \n"; } } close(FILE);
|