#!/usr/bin/perl use strict; use File::Glob qw(bsd_glob); my @dirlist = glob('\\\\servername\\path\\to\\docs\\with space in the path\\for the directory\\*'); foreach my $dir (@dirlist) { print $dir . "\n"; }