Unable to close the file, opened using ftp

Hi

args = Hash.new
args[:SRCHOST] = ENV['AUTO_HOSTNAME']
args[:SRCUSER]  = "root"
args[:SRCPASSWD] = ""
remotefile = File.basename('GlobalText.xml')
localfile  = File.basename('GlobalText.xml')
ftp = Net::FTP.new(args[:SRCHOST], args[:SRCUSER],args[:SRCPASSWD] )
ftp.chdir('/usr/ui/xui/localServerHome/language/en-US')
ftp.gettextfile(remotefile, localfile)
xmldoc = Document.new(File.new(localfile))

I have a problem in above code, when i am trying to delete the localfile
created on local disk, it is giving error saying access denied. How can
i delete the local file. For deleting am using File.delete(localfile).

Thanks in advance. Please help me in deleting.

Thanks
Saurabh

On Thu, Sep 22, 2011 at 11:37 AM, Saurabh A. [email protected] wrote:

ftp.gettextfile(remotefile, localfile)
xmldoc = Document.new(File.new(localfile))

Try this instead

xmldoc = File.open(localfile) {|io| Document.new(io)}

I have a problem in above code, when i am trying to delete the localfile
created on local disk, it is giving error saying access denied. How can
i delete the local file. For deleting am using File.delete(localfile).

Thanks in advance. Please help me in deleting.

Cheers

robert