raju_k
January 8, 2008, 6:33am
1
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
raju_k
January 8, 2008, 4:36pm
2
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 - InfoQ - 促进软件开发及相关领域知识与创新的传播-极客邦
raju_k
January 8, 2008, 7:32pm
3
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.