I created several directories and files with non-ANSI filenames, and the following code works fine on them - it iterates over the short names such as "C:\\Temp\\testuni\\5E71~1\\BF49~1.TXT".

use warnings; use strict; use Path::Class 'dir'; use IPC::Run3 'run3'; use Data::Dump; my $dir = dir("C:\\Temp\\testuni"); $dir->recurse( callback => sub { my $path = shift; if (!$path->is_dir) { run3 ['hex', $path], undef, \my $out; dd "$path", $out; } });

Don't use dir to get a list of filenames, which is why I'm using Path::Class (at the very least, use readdir). Please show a runnable, representative SSCCE that demonstrates the problem you're having, including sample input (directory structure), expected output for that input, and the actual output you're getting including any error messages.

And by representative I also mean to please show the actual command you're running, assuming it isn't robocopy - since its /l option means to just list files, I'm not sure what you're doing with that command in your sample code. One of the things discussed in The problem of "the" default shell, which is linked from my node referenced above, is that a common mistake is to shell out to commands that should be implemented in native Perl.


In reply to Re^2: How to pass a folder name to Windows external commands? by haukex
in thread How to pass a folder name to Windows external commands? by freonpsandoz

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.