in reply to Re: Processing data in on dir and copying, then processing into another dir
in thread Processing data in on dir and copying, then processing into another dir

I want to opendir "../Data/Sequencing_Results/Results 2009" for reading, then check subdirs "../Data/Sequencing_Results/Results 2009/*". Ex. "../Results 2009/Jan 2009". So is $topdir = "../Data/Sequencing_Results/Results 2009" ?
  • Comment on Re^2: Processing data in on dir and copying, then processing into another dir

Replies are listed 'Best First'.
Re^3: Processing data in on dir and copying, then processing into another dir
by zentara (Cardinal) on Jan 08, 2009 at 20:03 UTC
    If you want to open dir "../Data/Sequencing_Results/Results 2009", it means you are jumping up one directory. You should substitute your dirs in the example I gave, and see what you get. Using relative pathnames can always be tricky, so if in doubt, use the full system path, then you don't need to worry about the dot's
    #!/usr/bin/perl use File::Spec $filename= $0; $abs_path = File::Spec->rel2abs($filename); print "$abs_path\n"; $filename = File::Spec->abs2rel($abs_path); print "$filename\n";
    So in my example, say you were in a dir named 6, your topdir would be "../7" , as you suggest. But setup a test script that just does printouts with no copying, and see how your syntax works. Usually it's NOT a good idea to jump up dirs with .., so I would go with full path names and that will solve your problem.

    I'm not really a human, but I play one on earth Remember How Lucky You Are
      I agree about the relative pathnames and only used them for the example. I am using the full pathnames. I am currently setting up testdir1, testdir2 and cp actual data into them so that I can test the script.