I have several image files in tif format. They are placed in different folders like folder IMAGES>001,IMAGES>002,IMAGES>003 etc. I have a list of BEGDOC and ENDDOC based on that i have to create a opticon load file which gives me out BEGDOC foldername,Image path and the count of child documents and parent image being marked as Y. I have a script something like this.

use strict; #USER INPUTS print "Enter the Loadfile file which contains BegDoc and EndDoc\n"; chomp(my $in = <STDIN>); print "Enter the location of the Image file\n"; chomp(my $tiffpath = <STDIN>); print "Enter the Name of the Production\n"; chomp(my $prodvolumename = <STDIN>); my $delim = ""; my $textd = "þ"; chomp($in); my $out = $in . "\.opt"; my $header = 1; open OUT,">$out" or die "Cannot Create $out\n"; open IN, "<$in" or die "Cannot open $in\n"; while (<IN>) { chomp; next if ($header++==1); my $line = $_; $line =~ s/þ//gi; my @data = split(/$delim/,$line); my $start = $data[0]; $start =~ s/þ//gi; my $end = $data[1]; $end =~ s/þ//gi; my $snum = $start; $snum =~ s/[^0-9]+//gi; my $enum = $end; $enum =~ s/[^0-9]+//gi; my $pref = $end; $pref =~ s/[0-9]+//gi; my $pages = $enum - $snum +1; my $first = 1; for (my $i = $snum; $i <= $enum; $i++) { my $number = sprintf("%0*d",length($enum),$i); #print OUT $pref . $number . "," . $pref.$number . ",$tiffpath +\\$pref$number.tif,"; print OUT $pref . $number . "," . $prodvolumename . ",$tiffpat +h\\$pref$number.tif,"; if ($first == 1) { print OUT "Y,,,$pages\n"; $first++; } else { print OUT ",,,\n"; } } } close(IN); close(OUT);

The problem is the image path is not counting the folder in its path from where the tif file coming. EX: if tif is coming from Images/001/test.tif This script outputs Images/test.tif. Could anyone please solve this ASAP?


In reply to Traverse directory backwards based on file by subhash1198

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.