in reply to Re: Moving files to subfolders based on their last modified date
in thread Moving files to subfolders based on their last modified date

All excellent points, only issue I see is one of your suggestions was written wrong. You turned basic my arithmetic operation into a variable with an assignment operator without adding a = sign

$outdir = "_" . ($year+1900) . "\\" . ($mon+1) . "\\" ;

For a file modified today, Aug 26 2011 that would return

$year = 111
$mon = 7
$outdir = "_" . ($year+=1900) . "\\" . ($mon+=1) . "\\" ;

That will return what were actually looking for, tho I typically just use the $mon++ anyway for that and they both give.

$year = 2011
$mon = 8

In any case, thank you all for the suggestions I clearly overlooked some important issues too though oddly enough everything still worked ok i'll rewrite it for simplicity.

Replies are listed 'Best First'.
Re^3: Moving files to subfolders based on their last modified date
by jwkrahn (Abbot) on Aug 26, 2011 at 20:17 UTC
    one of your suggestions was written wrong

    No, it is not written wrong.    Did you actually try it?

    $ perl -le' $year = 111; $mon = 7; $outdir = "_" . ($year+=1900) . "\\" . ($mon+=1) . "\\"; print $outdir; ' _2011\8\ $ perl -le' $year = 111; $mon = 7; $outdir = "_" . ($year+1900) . "\\" . ($mon+1) . "\\"; print $outdir; ' _2011\8\

    It produces the result that you require.