Create a folder save a file in that and zip the folder

hi,
can anyone help me.

I want to create a folder, create another file of .url type and save the
.url file in the folder and zip the folder. I am sending the code which
I have written.

dir_name = Dir.new(“InstitutionShortcut”)
file_path =
“#{RAILS_ROOT}/public/test/#{dir_name}/Isabel-#{@institutions.institution_name}.url”
f = File.new(file_path, “w”)
content = “”
content += “[InternetShortcut]\n”
content += “URL=http://192.168.1.233:5555/index.jsp?”
content += “passcode=“[email protected]+”\n”
content += “IconFile=http://192.168.1.233:5555/favicon.ico\n”
content += “IconIndex=1\n”
content += “Modified=30B027EB835EC40198”
f.write( content )
f.close
dir_name.zip

can anyone help me

Thanks in advance

What was your problem?

On Jan 8, 2008 1:33 PM, Raju A.
[email protected] wrote:

“#{RAILS_ROOT}/public/test/#{dir_name}/Isabel-#{@institutions.institution_name}.url”
dir_name.zip

can anyone help me

Thanks in advance

Posted via http://www.ruby-forum.com/.


Jeff X.
Software Journeyman - http://gigix.thoughtworkers.org
Open Source Contributor - http://stomperl.googlecode.com/
Technical Evangelist - http://www.infoq.com/cn/

On Jan 8, 7:33 am, Raju A. [email protected]
wrote:

hi,
can anyone help me.

I want to create a folder, create another file of .url type and save the
.url file in the folder and zip the folder. I am sending the code which
I have written.

dir_name = Dir.new(“InstitutionShortcut”)

This will NOT create a directory. use dir.mkdir(…) for that.

f.write( content )
f.close
dir_name.zip

This will NOT zip your dir :). .zip is Enumerable method:
http://ruby-doc.org/core/classes/Enumerable.html#M003169

To make zip archives check the ‘rubyzip’ gem.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs