in reply to Re: Traverse directory backwards based on file
in thread Traverse directory backwards based on file

Hi Ken, Thank you for replying. The code is right. To make it more clear, let me give you more details on data. The input file looks like this

þBEGDOCþþENDDOCþ þHJH1411255þþHJH1411255þ þHJH1411256þþHJH1411256þ þHJH1411257þþHJH1411257þ þHJH1411258þþHJH1411258þ þHJH1411259þþHJH1411260þ þHJH1411261þþHJH1411262þ
and output from the above script looks like this
þHJH1411255,NAME,\\SHARE\OUTPUT3\HOST\CLIENT\NAME\AFT-053348\VOL_006\I +MAGES\HJH1411255.tif,Y,,,1 þHJH1411256,NAME,\\SHARE\OUTPUT3\HOST\CLIENT\NAME\AFT-053348\VOL_006\I +MAGES\HJH1411256.tif,Y,,,1 þHJH1411257,NAME,\\SHARE\OUTPUT3\HOST\CLIENT\NAME\AFT-053348\VOL_006\I +MAGES\HJH1411257.tif,Y,,,1 þHJH1411258,NAME,\\SHARE\OUTPUT3\HOST\CLIENT\NAME\AFT-053348\VOL_006\I +MAGES\HJH1411258.tif,Y,,,1 þHJH1411259,NAME,\\SHARE\OUTPUT3\HOST\CLIENT\NAME\AFT-053348\VOL_006\I +MAGES\HJH1411259.tif,Y,,,2 þHJH1411260,NAME,\\SHARE\OUTPUT3\HOST\CLIENT\NAME\AFT-053348\VOL_006\I +MAGES\HJH1411260.tif,,,,
The problem is after IMAGES i should get the subfolders also. like HJH1411260,NAME,\\SHARE\OUTPUT3\HOST\CLIENT\NAME\AFT-053348\VOL_006\IMAGES\001\HJH1411260.tif,,,, I have just 1 level folder structure after IMAGES folder. Now the point is based on the input file and the image path the script has to output complete image path till the file name. Let me know if you have questions or need clarifications.

Replies are listed 'Best First'.
Re^3: Traverse directory backwards based on file
by kcott (Archbishop) on Mar 30, 2014 at 12:56 UTC
    "Let me know if you have questions or need clarifications."

    Well, I've already done that but you haven't responded yet.

    I asked you to try some print statements; I even provided sample code. Did you do this? What was the result?

    I asked about which variable was supposed to hold 001. You haven't told us.

    [Separate issue.] Your output is dependent on user input. You don't show what that user input is.

    "and output from the above script looks like this"

    No, that's not possible! Look at this line:

    print OUT $pref . $number . "," . $prodvolumename . ",$tiffpath\\$pref +$number.tif,";

    How can this concatenation

    $pref . $number

    produce

    þHJH1411255

    when the same concatenation (albeit coded slightly differently)

    $pref$number

    produces

    HJH1411255

    Where did that thorn character come from in the first instance; or, conversely, how did it disappear in the second instance?

    Either that's not the output you're getting or you're running different code to what you posted.

    All I can do now is make guesses! Maybe the user isn't including 001 when entering $tiffpath. Maybe your code doesn't generate 001 for the output. Maybe something else.

    -- Ken

      Hi Ken, I cannot show the input folders or filename here as its a confidential data. Let me frame you the scenario: I have Folder containing IMAGE files in TIF format. They are spread across different subfolders like 001,002,003,004,005...etc . I am giving a path till the parent folder that is IMAGE folder. Then i have a load file containg starting page and ending page numbers as BEGDOC and ENDDOC respectively. These might have a difference of 1 or 2 or 3 or any number of pages. Remember, the IMAGE folder contains files in sequence which matches the file naming convention of load file. The output should be BEGDOC,prodvolume,Imagepath,Y, Here Y reperesents the parent file that is first page. I have shown how the input loadfile looks like previously. Based on that numbers the output should contain BEGDOC in single pages along with the corresponding tif path which matches with the names.

        There's no requirement to divulge confidential information. As a trivial example, you could change this real input and output

        $ perl -E 'say "Eyes Only: $ARGV[0]"' secret_info Eyes Only: secret_info

        to this example input and output

        $ perl -E 'say "Eyes Only: $ARGV[0]"' fred Eyes Only: fred

        I've asked questions which you haven't answered and raised points which you haven't addressed. It's up to you whether you want to help us to help you. I choose not to engage in any more guesswork.

        -- Ken