P
Peter Bailey
Hello,
With help from this forum, I've been successful in parsing through
directories of thousands of graphics files. I need to determine which
files are postscript EPS files. Any files that aren't EPS files I can
assume are TIFF files. I have to do this because our [unix] publishing
system doesn't use file extensions, so, in its image library, all
graphics files have no extensions. I'm needing to parse through these
files to get rid of any color files, make them grayscale. Anyway, I have
a directory now with over 23,000 files in it. I've run a script with
this clause in it.
Dir.glob("*").each do |file|
if /%!PS-Adobe/ =~ open(file) {|f| f.gets}
File.rename(file, file + ".eps")
end
end
It runs just fine and does a rename for 3123 files. But, then, suddenly,
it fails with a message:
Exception: Permission denied - in
Any ideas?
Thanks,
Peter
With help from this forum, I've been successful in parsing through
directories of thousands of graphics files. I need to determine which
files are postscript EPS files. Any files that aren't EPS files I can
assume are TIFF files. I have to do this because our [unix] publishing
system doesn't use file extensions, so, in its image library, all
graphics files have no extensions. I'm needing to parse through these
files to get rid of any color files, make them grayscale. Anyway, I have
a directory now with over 23,000 files in it. I've run a script with
this clause in it.
Dir.glob("*").each do |file|
if /%!PS-Adobe/ =~ open(file) {|f| f.gets}
File.rename(file, file + ".eps")
end
end
It runs just fine and does a rename for 3123 files. But, then, suddenly,
it fails with a message:
Exception: Permission denied - in
Any ideas?
Thanks,
Peter