情報学部 | 菅沼ホーム | 目次 | 索引 |
p File.atime("file1") # => Fri Jun 26 13:54:49 +0900 2009
p File.basename("/temp1/file1.txt") # => "file1.txt" p File.basename("/temp1/file1.txt", ".txt") # => "file1" p File.extname("/temp1/file1.txt") # => ".txt" p File.dirname("/temp1/file1.txt") # => "/temp1"
p File.basename("/temp1/file1.txt") # => "file1.txt" p File.basename("/temp1/file1.txt", ".txt") # => "file1" p File.extname("/temp1/file1.txt") # => ".txt" p File.dirname("/temp1/file1.txt") # => "/temp1"
p File.expand_path("file1") # => "c:/temp1/file1" p File.expand_path(".") # => "c:/temp1"
p File.basename("/temp1/file1.txt") # => "file1.txt" p File.basename("/temp1/file1.txt", ".txt") # => "file1" p File.extname("/temp1/file1.txt") # => ".txt" p File.dirname("/temp1/file1.txt") # => "/temp1"
p File.fnmatch("*.txt", "/temp1/file1.txt") # => true p File.fnmatch("*.txt", "/temp1/file1.txt", File::FNM_PATHNAME) # => false
io = File.open("file1", "r") p io.gets # => "data1 in file1\n" io.close
p File.split("/temp1/file1.txt") # => ["/temp1", "file1.txt"]
p File.utime(1246000000, Time.now, "file1") # => 1 p File.atime("file1") # => Fri Jun 26 16:06:40 +0900 2009 p File.mtime("file1") # => Fri Jun 26 17:03:47 +0900 2009
io = File.open("file1") p io.atime # => Mon Jun 15 08:42:42 +0900 2009 io.close
情報学部 | 菅沼ホーム | 目次 | 索引 |