Ruby 初心者スレッド Part 38
■ このスレッドは過去ログ倉庫に格納されています
0068デフォルトの名無しさん
2010/09/01(水) 21:49:04def listup(path, exclusion)
time_format = "%Y-%m-%d %H:%M:%S"
fullpath = File.expand_path(path)
print "\"dirname\",", "\"basename\",", "\"extension\",", "\"size(byte)\",", "\"ctime\",", "\"mtime\",", "\"atime\",", "\"sha1\"\n"
begin
Find.find(fullpath) do |entry|
begin
if exclusion != nil and entry =~ /#{exclusion}/
next
end
if File.file?(entry)
ctime = File::stat(entry).ctime
mtime = File::stat(entry).mtime
atime = File::stat(entry).atime
print "\"#{File::dirname(entry)}\","
print "\"#{File::basename(entry)}\","
print "\"#{File::extname(entry).downcase}\","
print "\"#{File::stat(entry).size}\","
■ このスレッドは過去ログ倉庫に格納されています