This has nothing to do with Perl. The arguments you are passing to dir are incorrect.
dir interprets / as the start of an option unless it's quoted,
- you have a space in the middle of the path that shouldn't be there, and
/s doesn't work with paths containing both / and a file component.
Additionally, you probably want /b in addition to /s.
Fixed:
dir "\\server1\dxx\mxx\rxx\ui.xml" /s/b
so
my $dir_output = `dir "\\\\server1\\dxx\\mxx\\rxx\\ui.xml" /s/b`;
Example,
>dir "//localhost/C$/Users/ikegami/Desktop/" /s/b
\\localhost\C$\Users\ikegami\Desktop\a.jpg
\\localhost\C$\Users\ikegami\Desktop\cabinet.txt
...
>dir "//localhost/C$/Users/ikegami/Desktop/a.jpg" /s/b
File Not Found <-- WTF?
>dir "\\localhost\C$\Users\ikegami\Desktop\a.jpg" /s/b
\\localhost\C$\Users\ikegami\Desktop\a.jpg
\\localhost\C$\Users\ikegami\Desktop\x\a.jpg
>dir \\localhost\C$\Users\ikegami\Desktop\a.jpg /s/b
\\localhost\C$\Users\ikegami\Desktop\a.jpg
\\localhost\C$\Users\ikegami\Desktop\x\a.jpg
>type a.pl
print `dir \\\\localhost\\C\$\\Users\\ikegami\\Desktop\\a.jpg /s/b`
>perl a.pl
\\localhost\C$\Users\ikegami\Desktop\a.jpg
\\localhost\C$\Users\ikegami\Desktop\x\a.jpg
That said, I'd personally use File::Find::Rule.
use File::Find::Rule qw( );
my $qfns =
File::Find::Rule
->name('ui.xml')
->file
->in('//server1/dxx/mxx/rxx');
rxxfolder using forward slashes but i can't recursively find files because/sparameter is interpreted as a file pathdir //server1/dxx/mxx/rss/, it displays all the files present in 'rss' but when i write thefile nameand/s, i get the errorno such file or directoryit also includes file nameui.xmlin the path-sinstead. Sounds weird, but as I remember, Unix like paths also means Unix like options.