in reply to Re^2: mv files from dir1 to dir2
in thread mv files from dir1 to dir2

It looks to me, like your $topdir, in your script, has Results_2008 on the hardcoded path, where my script, finds Results_2008 as a subdir, as your original specification was. So you have a path_logic error.

I'm not really a human, but I play one on earth Remember How Lucky You Are

Replies are listed 'Best First'.
Re^4: mv files from dir1 to dir2
by lomSpace (Scribe) on Jan 12, 2009 at 19:40 UTC
    Yes, under "/home/lomspace/testdir1/RESULTS 2008" there is
    /home/lomspace/testdir1/RESULTS 2008/DEC 2008/Results 12-01-08C
    The subdirs under /RESULTS 2008 all have the month and year.
    I want to peek into the dirs that start with /Results /d/d-/d/d-/d/d/D.
    If the have files that I want then I will move them, if not next peek into the next dir.
      Well do it! You've been shown how to get dirs and file lists and to grep thru them. So apply your regex.

      I'm not really a human, but I play one on earth Remember How Lucky You Are
        I am applying my regex here:
        foreach my $dir(@subdirs){ opendir my $dh, "$topdir/$dir" or die "Error: $!"; my @files = readdir $dh; print "raw files = @files\n"; @files = grep /^(\d+)(.+)(LacZ|pgK|SD|SU)$/,@files; print "$dir -> @files\n"; foreach my $file(@files){ system( "mv $topdir/$dir/$file $newdir/$file"); } closedir $dh; }
        I am only getting the subdir under "/home/mgavi/testdir1/RESULTS 2008".
        Do I have to grep "/home/lomspace/testdir1/RESULTS 2008/APRIL 2008/Results 09-02-08D"?
        I am confused on using grep to get to the files here.
        There dirs for each month and under each month there are many "Results" files.
        Your wisdom can lead to my enlightenment.