Good day bros. I want to write a script that will automatically copy files from a flash drive to a backup directory on my hard drive. I have given the drive a particular name, but since it might be plugged into the USB along with other devices I can't be sure it will always have the same drive letter. So the question is, how do I read the entries in "my computer" to look for the drive with a given name?

opendir/readdir presumes (as far as I can tell) that you can specify the drive letter. I looked at Win32::FileOp for a solution. It would let me browse for it with a dialog box, but I want to find the drive letter without browsing by reading the items in "my computer" a picking the one with the correct name.

Your advice appreciated.

Steve


In reply to Locating a flash drive on windows by cormanaz

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.