33件ヒット
[1-33件を表示]
(0.030秒)
種類
- インスタンスメソッド (22)
- 特異メソッド (11)
クラス
- File (11)
-
File
:: Stat (11) - Pathname (11)
検索結果
-
File
:: Stat # nlink -> Integer (18208.0) -
ハードリンクの数を返します。
...ハードリンクの数を返します。
//emlist[][ruby]{
fs = File::Stat.new($0)
#例
p fs.nlink #=> 1
//}... -
File
. unlink(*filename) -> Integer (3202.0) -
ファイルを削除します。削除したファイルの数を返します。 削除に失敗した場合は例外 Errno::EXXX が発生します。
...。
//emlist[例][ruby]{
IO.write("test.txt", "test")
p File.exist?("test.txt") # => true
p File.delete("test.txt") # => 1
p File.exist?("test.txt") # => false
begin
File.delete("test.txt")
rescue
p $! # => #<Errno::ENOENT: No such file or directory @ unlink_internal - test.txt>
end
//}... -
Pathname
# unlink -> Integer (3202.0) -
self が指すディレクトリあるいはファイルを削除します。
...self が指すディレクトリあるいはファイルを削除します。
//emlist[例][ruby]{
require "pathname"
pathname = Pathname("/path/to/sample")
pathname.exist? # => true
pathname.unlink # => 1
pathname.exist? # => false
//}...