ライブラリ
- ビルトイン (663)
- pathname (12)
- shell (150)
-
shell
/ command-processor (150) -
shell
/ filter (150) - tempfile (24)
- tmpdir (24)
- zlib (60)
クラス
- Dir (24)
- File (285)
-
File
:: Stat (36) - Pathname (12)
- Shell (150)
-
Shell
:: CommandProcessor (150) -
Shell
:: Filter (150) - Tempfile (24)
-
Zlib
:: GzipWriter (60)
モジュール
- FileTest (318)
キーワード
- Stat (12)
- [] (18)
- blockdev? (42)
- chardev? (42)
- close (12)
- close! (12)
- directory? (54)
- empty? (18)
- executable? (42)
-
executable
_ real? (42) - exist? (42)
- exists? (27)
- file? (54)
- grpowned? (42)
- identical? (24)
- mktmpdir (24)
- new (12)
- open (24)
- owned? (42)
- pipe? (42)
- readable? (42)
-
readable
_ real? (42) -
ruby 1
. 8 . 4 feature (12) - setgid? (42)
- setuid? (42)
- size (42)
- size? (54)
- socket? (42)
- sticky? (42)
- symlink? (54)
- test (18)
-
world
_ readable? (12) -
world
_ writable? (12) - wrap (24)
- writable? (42)
-
writable
_ real? (42) - zero? (42)
- セキュリティモデル (12)
検索結果
先頭5件
-
FileTest (44012.0)
-
ファイルの検査関数を集めたモジュールです。
...を集めたモジュールです。
=== 注意
FileTest で定義された各メソッドは、システムコールに失敗しても例外を発生させません。
真を返した時のみ、返り値は意味をもちます。
例えば、
File.exist?('/root/.bashrc')
が false を返して... -
FileTest
. # file?(file) -> bool (30256.0) -
ファイルが通常ファイルである時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...am file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
FileTest.file?('/bin/bash') # => true
FileTest.file?('/bin') # => false
FileTest.f......ile?('/no_such_file') # => false... -
FileTest
. # identical?(file1 , file2) -> bool (24312.0) -
file1 と file2 が同じファイルを指している時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...
file1 と file2 が同じファイルを指している時に真を返します。
そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
ruby 1.8.3 以前ではKernel.#test(?-, file1, file2)を使......p File.identical?("a", "a") #=> true
p File.identical?("a", "./a") #=> true
File.link("a", "b")
p File.identical?("a", "b") #=> true
File.symlink("a", "c")
p File.identical?("a", "c") #=> true
open("d", "w") {}
p File.identical?("a", "d") #=> false
@param file1......ァイル名を表す文字列か IO オブジェクトを指定します。
@param file2 ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file1, file2 が既に close されていた場合に発生します。... -
FileTest
. # directory?(file) -> bool (24143.0) -
ファイルがディレクトリの時に真を返します。そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...します。
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
FileTest.directory?('/etc') # => true
FileTest.directory?('/etc/pa......sswd') # => false
f = File.open('/etc')
FileTest.directory?(f) # => true
f.close
FileTest.directory?(f) # => IOError: closed stream... -
FileTest
. # exist?(file) -> bool (24143.0) -
ファイルが存在する時に真を返します。そうでない場合、あるいはシステムコールに失敗した場合などには false を返します。
...m file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
FileTest.exist?('/etc/passwd') # => true
FileTest.exist?('/etc') # => true
FileTest.......exist?('/etc/no_such_file') # => false
FileTest.exist?('/etc/no_such_directory') # => false... -
FileTest
. # size?(file) -> Integer | nil (24143.0) -
ファイルのサイズを返します。ファイルが存在しない時や ファイルのサイズが0の時には nil を返します。
...m file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "test")
FileTest.size?("testfile") # => 4
File.......delete("testfile")
FileTest.size?("testfile") # => nil
//}
@see FileTest.#size, FileTest.#zero?... -
FileTest
. # empty?(file) -> bool (24138.0) -
ファイルが存在して、そのサイズが 0 である時に真を返します。 そうでない場合、あるいはシステムコールに失敗した場合には false を返します。
...します。
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
//emlist[例:][ruby]{
IO.write("zero.txt", "")
FileTest.zero?("zero.txt")......# => true
IO.write("nonzero.txt", "1")
FileTest.zero?("nonzero.txt") # => false
//}
@see FileTest.#size, FileTest.#size?... -
FileTest
. # zero?(file) -> bool (24138.0) -
ファイルが存在して、そのサイズが 0 である時に真を返します。 そうでない場合、あるいはシステムコールに失敗した場合には false を返します。
...します。
@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
//emlist[例:][ruby]{
IO.write("zero.txt", "")
FileTest.zero?("zero.txt")......# => true
IO.write("nonzero.txt", "1")
FileTest.zero?("nonzero.txt") # => false
//}
@see FileTest.#size, FileTest.#size?... -
FileTest
. # blockdev?(file) -> bool (24137.0) -
ファイルがブロックスペシャルファイルである時に真を返します。 そうでない場合、ファイルが存在しない場合、あるいはシステムコールに失敗した場合などには false を返します。
...@param file ファイル名を表す文字列か IO オブジェクトを指定します。
@raise IOError 指定された IO オブジェクト file が既に close されていた場合に発生します。
例:
Dir.glob("/dev/*") { |file|
puts file if FileTest.blockdev?(file)
}
# /d...