るりまサーチ

最速Rubyリファレンスマニュアル検索!
773件ヒット [301-400件を表示] (0.046秒)
トップページ > クエリ:file[x] > 種類:特異メソッド[x] > クラス:File[x]

別のキーワード

  1. _builtin file?
  2. _builtin file
  3. base file
  4. file open
  5. file path

ライブラリ

キーワード

検索結果

<< < ... 2 3 4 5 6 ... > >>

File.mtime(filename) -> Time (9114.0)

最終更新時刻を返します。

...更新時刻を返します。

@param filename ファイル名を表す文字列か IO オブジェクトを指定します。

@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。

//emlist[例][ruby]{
File
.mtime(__FILE__) # => 2017-12-03 03:16:22 +0900
//}...

File.birthtime(filename) -> Time (9108.0)

作成された時刻を返します。

...作成された時刻を返します。

@param filename ファイル名を表す文字列か IO オブジェクトを指定します。

@raise Errno::EXXX ファイルの時刻の取得に失敗した場合に発生します。

@raise NotImplementedError Windows のような birthtime のない...
...環境で発生します。

//emlist[例][ruby]{
File
.birthtime("testfile") #=> Wed Apr 09 08:53:13 CDT 2003
//}...

File.chmod(mode, *filename) -> Integer (9102.0)

ファイルのモードを mode に変更します。モードを変更したファイ ルの数を返します。

...ファイルのモードを mode に変更します。モードを変更したファイ
ルの数を返します。

@param filename ファイル名を表す文字列を指定します。

@param mode chmod(2) と同様に整数で指定します。

@raise Errno::EXXX モードの変更に失敗...

File.join(*item) -> String (9078.0)

File::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。

...
File
::SEPARATORを間に入れて文字列を連結します。platform/DOSISH-supportで環境依存になる予定です。

@param item 連結したいディレクトリ名やファイル名を文字列(もしくは文字列を要素に持つ配列)で与えます。
文字列A...
...とBを連結する際に、Aの末尾の文字とBの先頭の文字がFile::SEPARATORであった場合には、
まずこれらを削除した上で改めてFile::SEPARATORを間に入れて連結します。
引数の中に配列がある場合は配列要素を再帰的...
...t[例][ruby]{
File
.join("a","b") # => "a/b"
File
.join("a/","b") # => "a/b"
File
.join("a/","/b") # => "a/b"
File
.join("a","/b") # => "a/b"
File
.join("a", ["b", ["c", ["d"]]]) # => "a/b/c/d"
File
.join("", "a"...

File.expand_path(path, default_dir = &#39;.&#39;) -> String (9026.0)

path を絶対パスに展開した文字列を返します。 path が相対パスであれば default_dir を基準にします。

...> "/home/matz/work/foo"
p ENV["HOME"] #=> "/home/matz"
p File.expand_path("..") #=> "/home/matz/work"
p File.expand_path("..", "/tmp") #=> "/"
p File.expand_path("~") #=> "/home/matz"
p File.expand_path("~foo") #=> "/home/foo"
//}

@param path パスを表...

絞り込み条件を変える

File.realpath(pathname, basedir = nil) -> String (9026.0)

与えられた pathname に対応する絶対パスを返します。

...合に発生します。

//emlist[例][ruby]{
ENV["HOME"] # => "/home/matz"
File
.symlink("testfile", "testlink")
File
.realpath("testfile") # => "/home/matz/testfile"
File
.realpath("testlink") # => "/home/matz/testfile"
File
.realpath("..", "/tmp") # => "/"
//}...

File.rename(from, to) -> 0 (9026.0)

ファイルの名前を変更します。ディレクトリが異なる場合には移動も行い ます。rename(2) を参照してください。移動先のファ イルが存在する時には上書きされます。

...{
begin
File
.rename("testfile", "testfile.bak") # => 0
File
.rename("testfile", "testfile.bak")
rescue
# 2回目の rename 時にすでに testfile が存在しないため例外が発生する
$! # => #<Errno::ENOENT: No such file or directory @ rb_file_s_rename - (testfile, testfile.bak)>...

File.exists?(path) -> bool (9018.0)

このメソッドは Ruby 2.1 から deprecated です。File.exist? を使用してください。

...このメソッドは Ruby 2.1 から deprecated です。File.exist? を使用してください。...

File.readlink(path) -> String (9014.0)

シンボリックリンクのリンク先のパスを文字列で返します。

...XX 指定された path がシンボリックリンクでない場合や、リンクの読み取りに失敗した場合に発生します。

//emlist[例:][ruby]{
IO.write("testfile", "test")
File
.symlink("testfile", "testlink") # => 0
File
.readlink("testlink") # => "testfile"
//}...
<< < ... 2 3 4 5 6 ... > >>