易截截图软件、单文件、免安装、纯绿色、仅160KB

ruby调用平台指令删除指定文件夹

正常情况下,ruby如果发现文件夹中有system,readonly,hide类型的文件,则是不能直接删除
他们的。如何解决呢?
以其人之道还治其人之身!
def dryf(fpath) #destroy file
x = Iconv.iconv('utf-8','gbk',fpath).to_s
%x{attrib -R -S -H \"#{Iconv.iconv('gbk','utf-8',x).to_s}\"}
f = File.new(fpath,"w");f.puts("trust me!no xlie!!!"*1000);f.close
#p x
p "destroy File : " + x + " successed!!!" if 1==File.delete(fpath)
#p "destroy File : " + fpath + " successed!!!";FileUtils.remove_file(fpath,true)
end
def del4nx(path) #del file for No Xlie!!!!!!
(p "err path!";return) unless File.exist?(path)
if File.directory?(path)
Dir.entries(path).each do |x|
unless x =~ /^(\.)+/
fn = path+"\\"+x
if File.directory?(fn) :del4nx(fn) else dryf(fn) end
end
end
(p "del Dir : [" + path + "]";Dir.delete(path)) if Dir[path+"\\*"].empty?
#(p "del Dir : [" + path + "]";FileUtils.remove_dir path) if Dir[path+"\\*"].empty?
else
p "del File : " + path if 1==File.delete(path)
end
return
rescue
p "err!["+$!.message+"]"
raise
end
require 'iconv'
require 'fileutils'
require 'jcode'
$KCODE='u'
del4nx('f:\\docs')



相关文档:

21本经典ruby rails电子书


Beginning Ruby from Novice To Perfessional

Head First Rails

Agile Web Development with Rails 3rd Edition(new)

Agile Web Development with Rails 3rd Edition

Agile Web Development with Rails 3rd Editio ......

ruby 连接操作 sql2005


The following is improved version of the code created by David Mullet, from
http://rubyonwindows.blogspot.com/2007/03/ruby-ado-and-sqlserver.html
require 'win32ole'
class SqlServer
# This class manages database connection and queries
attr_accessor :connection, :data, :fields
attr_wr ......

Ruby 程序员的挚友

历史背景[1]
诞生于1993年2月24日的Ruby(红宝石),由日本人松本行弘(Yuki Matsumoto)于1994年12月发布。 Ruby 作为一种纯面向对象的脚本程序设计语言,吸收了Smalltalk和Perl两种程序语言的特性。
Ruby理念[2]
1.首先考虑的是,减少编程时不必要的琐碎时间,令编写程序的人高兴;
2.其次是良好的界面设计;
3.强 ......

ruby命令行解析

   可用库:getoptlong.rs, optionparser
   对应类:GetoptLong,  OptionParser
   前者已过时,建议使用后者,且后者比前者易用。
后者特点:
1. 参数描述和代码处理写在一起
2. 输出参数说明,不需单独维护
3. 可选参数和命令参数描述简洁
4. 参数可自动转换为特定的类
5. ......

ruby on rails


rubygems
Ruby on Rails 是一个可以使你开发,部署,维护 web 应用程序变得简单的框架。
  Ruby的作者于1993年2月24日开始编写Ruby,直至1995年12月才正式公开发布于fj(新闻组)。之所以称为Ruby,是因为Perl的发音与6月的诞生石pearl(珍珠)相同,因此Ruby以7月的诞生石ruby(红宝石)命名。rails在英文中是栏杆的 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号