J
jbl
I am an extreme novice but I can do simple things with examples.
The following is the first part of something I am working on. It
basically gets all filenames of PDF files in a path, input to the
command line.
It then calls pdftotext with the parameters, remove pagebreaks, the
target PDF file, the output file (in text subfolder). The target
filename is the same as the output filename except for the extension.
My problem is that while this works fine, I get the error messages
that I have included at the bottom of this message.
Any suggestions as to what I can do to prevent these errors?
Thanks
jbl
# command line input >pdflang2 C:\test_docs
use File::Basename;
fileparse_set_fstype("MSWin32");
# uses path to pdf files from command line argument
# ARGV[0] = C:\test_docs here
opendir (DIR,$ARGV[0]) || die "Couldn't open directory, !";
while ($file= readdir DIR){
($basename,$path,$extension) = fileparse("$ARGV[0]/$file",
qr{\.pdf});
# now I am calling pdftotext to extract the text from the PDF
# and save it as C:\test_docs\text\$basename.txt
system
("pdftotext","-nopgbrk","$path/$file","$path/text/$basename.txt");
}
close DIR;
My command line input:
D:\PerlScripts>pdflang2 C:\test_docs
I am getting the following error messages to the screen:
Error: Couldn't open file 'C:\test_docs//.'
Error: Couldn't open file 'C:\test_docs//..'
Error: Couldn't open file 'C:\test_docs//text'
The following is the first part of something I am working on. It
basically gets all filenames of PDF files in a path, input to the
command line.
It then calls pdftotext with the parameters, remove pagebreaks, the
target PDF file, the output file (in text subfolder). The target
filename is the same as the output filename except for the extension.
My problem is that while this works fine, I get the error messages
that I have included at the bottom of this message.
Any suggestions as to what I can do to prevent these errors?
Thanks
jbl
# command line input >pdflang2 C:\test_docs
use File::Basename;
fileparse_set_fstype("MSWin32");
# uses path to pdf files from command line argument
# ARGV[0] = C:\test_docs here
opendir (DIR,$ARGV[0]) || die "Couldn't open directory, !";
while ($file= readdir DIR){
($basename,$path,$extension) = fileparse("$ARGV[0]/$file",
qr{\.pdf});
# now I am calling pdftotext to extract the text from the PDF
# and save it as C:\test_docs\text\$basename.txt
system
("pdftotext","-nopgbrk","$path/$file","$path/text/$basename.txt");
}
close DIR;
My command line input:
D:\PerlScripts>pdflang2 C:\test_docs
I am getting the following error messages to the screen:
Error: Couldn't open file 'C:\test_docs//.'
Error: Couldn't open file 'C:\test_docs//..'
Error: Couldn't open file 'C:\test_docs//text'