Pernisssion denied when trying to delete or mv file

Discussion in 'Ruby' started by Carl Graff, Oct 13, 2006.

  1. Carl Graff

    Carl Graff Guest

    I have a problem deleting a file (or move a file) that has a UNC path. I
    am using 1.8.4 on windows and this same thing did work in 1.8.2.

    Here is the pertinent excerpt of code:
    =========================================
    puts shp.source; ==> returns
    //rm-graff-c/c$/ftpxfr/somefile2454018103834.txt
    puts LOCDIR + '/failed_files' ==>
    returns //rm-graff-c/c$/ftpxfr//failed_files
    cp(shp.source, LOCDIR + 'failed_files') ==> this works fine
    puts File.file?(shp.source) ==> this returns true
    rm(shp.source) ==> this fails with:
    C:/ruby/lib/ruby/1.8/fileutils.rb:1281:in `unlink':
    Permission denied - //rm-graff-c/c$/ftpxfr/somefile2454018103834.txt
    (Errno::EACCES)
    mv(shp.source, LOCDIR + 'failed_files') => this also fails

    =========================================
    I also tried File.delete(...) and several other variations. I really
    doubt
    that the file is open. I do read from earlier in the program using CSV
    but this is in a block and the end of the block (to my knowlege) should
    be automatically closing the file. I could resort to using .new and
    explictily closing the file when CSV reading is done but I more suspect
    that someting has happened between 1.8.2 and 1.8.4 that is the culprit.

    Any ideas? Is this a perhaps a known issue that 1.8.5 fixes. I can with
    a little effort try on unix but I am not sure how to form the equivelent
    UNC pathname in unix to //rm-graff-c/c$/ftpxfr/somefile2454018103834.txt
    - is the C$ just a windows thing?


    Thanks,
    Carl

    --
    Posted via http://www.ruby-forum.com/.
     
    Carl Graff, Oct 13, 2006
    #1
    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. =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=

    Access to the path is denied - trying to write a file

    =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?=, Dec 15, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    28,255
    Steven Cheng[MSFT]
    Dec 16, 2005
  2. Replies:
    2
    Views:
    4,363
    mausingh
    Nov 19, 2010
  3. Viewer T.
    Replies:
    2
    Views:
    1,127
    Jay Loden
    Jul 14, 2007
  4. MRAB
    Replies:
    5
    Views:
    257
  5. Antoine De Groote

    File.delete -> Permission denied

    Antoine De Groote, Apr 8, 2007, in forum: Ruby
    Replies:
    4
    Views:
    294
    Antoine De Groote
    Apr 9, 2007
Loading...

Share This Page