I need to do the following: 1. opendir 2. Check folder name for current month year. a. If not current skip. b. If current then opendir. 3. Check the first file's name in the dir a. If 1st file's name does not contain, one of four regex's. then skip. b. Else read file names. c. Iterate through the files and parse out the id #. d. create a hash with the file name and parsed id# to match files with the same id# that occur exactly four times. e. save those that meet criteria of step 3d. Possibly in a glob. 4. chdir 5. mv data from step 3e to working dir. Next do: a. create another hash to match id# from step 3c with subdir names in working dir. b. Upon match of subdir open it and mkdir with id#_sa. c. Deposit the moved files that have same id# as subdir name into the newly created dir id#_sa.(id#_sa ex. 12335_sa) Here is my code:
#!/usr/bin/perl -w use strict; use warnings; use File::Copy; opendir( RS, "seqresults/resultsdate"); my %rs; while (defined($rs = readdir (RS))) { @rs_info = split(/_/,$rs); my $idnum= $fields[0]; if ($count == null){ ${maid}=1; }else{ ${maid}=$count+1; } foreach my $maid ( keys %h ){ if ($h{$maid}==4){ #call routine to do your copy logic } } } closedir RS; opendir( SA, "/newdir/");
# This is what i have thus far. Need help!

In reply to Processing data in on dir and copying, then processing into another dir by lomSpace

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.