PERL windows : "Windows cannot access the specified device, path orfile. You may not have the approp

Discussion in 'Perl Misc' started by guru, Feb 18, 2009.

  1. guru

    guru Guest

    Hi,

    I am getting following error
    "
    "Windows cannot access the specified device, path or file. You may not
    have the appropriate permission to access the item."

    When i tried to pass a list consisting of 300 file names.

    Scenario:

    folder F:\Testing\loc\

    Contains around 300 files

    I have to pass these files as parameter to one perl script .pl,
    where these files are processed( opened and read).

    Alg:

    take each file and concatenate them to a list

    like:

    while($filename = readdir(DIR))
    {
    $list .= $filename;
    }

    At the end, the list contains 300 file names.

    When I pass this as parameter to .pl file in windows it is throwing
    error:

    "Windows cannot access the specified device, path or file. You may not
    have the appropriate permission
    to access the item."

    But when I create list of around 70 files and pass then it is working
    fine.

    But passing list of files as argument in linux is working fine. But
    failing in windows.

    Is there any alternative way to resolve this problem.

    Thanks & Regards
    Gururaja
     
    guru, Feb 18, 2009
    #1
    1. Advertising

  2. Re: PERL windows : "Windows cannot access the specified device, path or file. You may not have the appropriate permission to access the item."

    guru <> wrote:


    > I am getting following error
    > "
    > "Windows cannot access the specified device, path or file. You may not
    > have the appropriate permission to access the item."



    > take each file and concatenate them to a list
    >
    > like:
    >
    > while($filename = readdir(DIR))
    > {
    > $list .= $filename;
    > }



    So if readdir() returns "1.doc" and "2.doc", then $list (which is not a list)
    will contain "1.doc2.doc".

    Is that what you wanted to do?

    Did you try printing out $list after the while loop?


    --
    Tad McClellan
    email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
     
    Tad J McClellan, Feb 18, 2009
    #2
    1. Advertising

  3. Re: PERL windows : "Windows cannot access the specified device, pathor file. You may not have the appropriate permission to access the item."

    guru wrote:
    >
    > while($filename = readdir(DIR))
    > {
    > $list .= $filename;
    > }


    How about

    my $list = join ' ', readdir DIR;

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Feb 18, 2009
    #3
  4. Re: PERL windows : "Windows cannot access the specified device, pathor file. You may not have the appropriate permission to access the item."

    guru wrote:
    >
    > folder F:\Testing\loc\
    >
    > Contains around 300 files
    >
    > I have to pass these files as parameter to one perl script .pl,
    > where these files are processed( opened and read).
    >
    > Alg:
    >
    > take each file and concatenate them to a list
    >
    > like:
    >
    > while($filename = readdir(DIR))
    > {
    > $list .= $filename;
    > }
    >
    > At the end, the list contains 300 file names.
    >
    > When I pass this as parameter to .pl file in windows it is throwing
    > error:
    >
    > "Windows cannot access the specified device, path or file. You may not
    > have the appropriate permission
    > to access the item."


    Can it possibly be that there is a space in one or more of the files? In
    that case you may want to try:

    my $list = '"' . join('" "', grep !/^\.{1,2}/, readdir DIR) . '"';

    --
    Gunnar Hjalmarsson
    Email: http://www.gunnar.cc/cgi-bin/contact.pl
     
    Gunnar Hjalmarsson, Feb 18, 2009
    #4
  5. guru

    J. Gleixner Guest

    Re: PERL windows : "Windows cannot access the specified device, pathor file. You may not have the appropriate permission to access the item."

    guru wrote:
    > Hi,
    >
    > I am getting following error
    > "
    > "Windows cannot access the specified device, path or file. You may not
    > have the appropriate permission to access the item."
    >
    > When i tried to pass a list consisting of 300 file names.
    >
    > Scenario:
    >
    > folder F:\Testing\loc\
    >
    > Contains around 300 files
    >
    > I have to pass these files as parameter to one perl script .pl,
    > where these files are processed( opened and read).


    How are you passing the files and how is the other program
    reading the input?
     
    J. Gleixner, Feb 18, 2009
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sam Iam
    Replies:
    0
    Views:
    463
    Sam Iam
    Jan 31, 2004
  2. shoplifes
    Replies:
    0
    Views:
    317
    shoplifes
    Nov 25, 2007
  3. kingchuffalo
    Replies:
    0
    Views:
    875
    kingchuffalo
    Sep 21, 2008
  4. Gilles Ganault
    Replies:
    2
    Views:
    608
    Gilles Ganault
    Oct 24, 2008
  5. Matt
    Replies:
    0
    Views:
    488
Loading...

Share This Page