Question about capturing a file name with 
spaces using regular expressions.

What I'm trying to do is get a list of files
and then only print the file names from the path.

I would use the readdir option, but that returns '.'
and '..'.  I've also heard about FILE: BASENAME(I think
it's called that  - have no idea what it is).
This is what I have so far:

[snip script]


#$padir='/pastate/hmp';
$sambadir='/samba/hmp/iso';

# mount command for looping devices
#$mount_me=`/bin/mount -rt iso9660 -o loop`;

#opendir (TARGETDIR, $padir ) or die "can nae access smb NT mounted
directory: $!";
opendir (DESTDIR, $sambadir) or die "can nae access local smb mounted
directory: $!";

foreach my $group ( split (/\n/,`ls -d1 $sambadir/*/*`) ) {
        ##my $names=(split m!/!)[-1];   # not working
        ##my ($names) = m!([^/]+)$!;    # not working
        print "$group\n";
        print "$names\n";
        }


#closedir (TARGETDIR);
closedir (DESTDIR);

[/snip script]

The output looks like this (the result of just $group).

[snip example]

/samba/hmp/iso/06/UNASSIGNED-06 - DUMMY-06.iso

[/snip example]

My goal is to print "UNASSIGNED-06 - DUMMY-06.iso"  (and
then later on cut out the .iso part).  If I can do that,
then I think I can do the rest.

Suggestions?

Thanks!

-X

Reply via email to