Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > different behaviour when accessing HD or USB storage

Reply
Thread Tools

different behaviour when accessing HD or USB storage

 
 
PilotMI80
Guest
Posts: n/a
 
      09-13-2004
Hi all,

When trying to access a USB key with :

foreach(<$path/*>)
(or any combination of quotes )

it seems nothing is found.
The same actually works if $path is on my hard disk.

So, by now, I replaced this construction with :

opendir(DH, "$SourceFolder") or die "msg";
my @FolderContents = readdir DH;
closedir DH;
foreach(@FolderContents)

and it works perfectly (on both file systems)

My question is : is there a kind of flush mechanism that I missed ? or
will I have to use the workaround ?
Anyone got this kind of behaviour ?
 
Reply With Quote
 
 
 
 
Joe Smith
Guest
Posts: n/a
 
      09-15-2004
PilotMI80 wrote:

> When trying to access a USB key with :
>
> foreach(<$path/*>)
> (or any combination of quotes )


That is guaranteed to fail if $path contains spaces in the name,
like "e:/My Files". As you've seen, readdir() does not have
that problem.
-Joe
 
Reply With Quote
 
 
 
 
PilotMI80
Guest
Posts: n/a
 
      09-16-2004
Joe Smith <> wrote in message news:<GeU1d.438135$%_6.292304@attbi_s01>...
> PilotMI80 wrote:
>
> > When trying to access a USB key with :
> >
> > foreach(<$path/*>)
> > (or any combination of quotes )

>
> That is guaranteed to fail if $path contains spaces in the name,
> like "e:/My Files". As you've seen, readdir() does not have
> that problem.
> -Joe


thanks for your try, i have to be a bit more precise so you can answer
well


By "any combination of quotes", I meant white spaces were not the pb
cause I actually use "$path"/* :

For my tests I copied part of the hierarchy so that replacing the
drive letter has no incidence on the structure.

if $path is c:/foo, it works ok but if $path is f:/foo, it doesn't.
I guess there's a pb with the buffering with the key.
(I use Perl 5.6)

I can keep on with opendir but the con is that I need a global handle
for each.

thx
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Different behaviour in different struct declaration types __PaTeR C Programming 7 01-01-2009 12:13 AM
debugger behaviour different to execution behaviour Andy Chambers Java 1 05-14-2007 09:51 AM
How to access the external storage unit of storage router =?Utf-8?B?SWduYXRpdXM=?= Wireless Networking 4 11-06-2006 06:40 AM
how to disable usb-storage not usb-mouse? mc??? MCSD 2 08-31-2006 01:48 PM
Re: USB issue ... some USB 2 ports working only in USB 1 mode hungsolo2005@yahoo.com A+ Certification 0 06-14-2006 07:26 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57