Why do you have two back-slashes next to each other after the "\dir"?

What is the current working directory for the shell that runs your perl script?

You are using the glob operator in the script's current working directory in order to get the list of directories to search through, so (if windows works like any other normal OS) you shouldn't need to include all that initial stuff ('C:\Documents and Settings\user\Desktop\dir\') when assigning a value to $path. Just put the value of $directory at the beginning of $path.

Apart from that, are you certain that every directory (or any directory) contained in the script's current working directory actually contains a sub-path called '2010\01\01'?

When you say "I get the duplicate message but the files are not being added to the @delete array.", do you mean the output is "There are 0 duplicate files to delete"? If so, the previous questions are relevant.

Do you see the outputs that say "Searching (path_string)"? If so, have you checked and made sure that the path strings in those messages are paths that actually exist? If so, do those paths actually contain any duplicate files? If the answer is "no" to any of that, then the script would seem to be working, in the sense that it can't find any duplicate files to delete.

Update: BTW, your use of grep on the glob is not a good idea, I think, because it allows both "." and ".." to pass through into your @directories array. A better usage would be:

@directories = grep { /[^.]/ && -d } <*>; # list items must be direct +ories whose # names contain something b +esides '.'
(updated again to put the regex match in front of the more expensive "-d" function call)

In reply to Re: delete duplicates in windows subdirectories by graff
in thread delete duplicates in windows subdirectories by casimo

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.