Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Pernisssion denied when trying to delete or mv file

Thread Tools

Pernisssion denied when trying to delete or mv file

Carl Graff
Posts: n/a
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
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
mv(shp.source, LOCDIR + 'failed_files') => this also fails

I also tried File.delete(...) and several other variations. I really
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?


Posted via

Reply With Quote

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
delete file access denied to the authorized folder(no way out) ASP .Net 2 11-19-2010 06:10 PM
Access Denied while trying to delete file from python script Viewer T. Python 2 07-14-2007 03:31 PM
Access Denied errors when trying delete a WIndows XP folder farseer Computer Support 1 02-11-2007 06:36 PM
Access to the path is denied - trying to write a file =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= ASP .Net 3 12-16-2005 06:30 AM
file delete access denied? pel Computer Support 3 04-13-2004 09:30 PM