ライブラリ
- ビルトイン (154)
- etc (11)
- fileutils (44)
- pathname (44)
-
rubygems
/ installer (11) - shell (30)
-
shell
/ command-processor (30) -
shell
/ filter (30) - tempfile (11)
クラス
- File (99)
-
File
:: Stat (33) -
Gem
:: Installer (11) - Pathname (44)
- Shell (30)
-
Shell
:: CommandProcessor (30) -
Shell
:: Filter (30) - Tempfile (11)
キーワード
-
1
. 6 . 8から1 . 8 . 0への変更点(まとめ) (11) - Marshal フォーマット (11)
-
NEWS for Ruby 2
. 5 . 0 (7) -
PC
_ FILESIZEBITS (11) - cleanpath (11)
- ftype (22)
-
generate
_ bin _ symlink (11) - identical? (11)
- lchmod (11)
- lchown (11)
- ln (11)
- lstat (11)
-
make
_ link (11) -
make
_ symlink (11) - nlink (11)
- rdoc (11)
- readlink (40)
- rss (11)
-
ruby 1
. 8 . 4 feature (11) -
ruby 1
. 8 . 5 feature (11) -
safe
_ unlink (11) - symlink (40)
- symlink? (51)
- un (11)
- unlink (40)
検索結果
先頭5件
-
File
. link(old , new) -> 0 (39113.0) -
old を指す new という名前のハードリンクを 生成します。old はすでに存在している必要があります。 ハードリンクに成功した場合は 0 を返します。
...を指定します。
@param new ファイル名を表す文字列を指定します。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
IO.write("testfile", "test")
File.link("testfile", "testlink") # => 0
IO.read("testlink") # => "test"
//}... -
File
. readlink(path) -> String (27112.0) -
シンボリックリンクのリンク先のパスを文字列で返します。
...XX 指定された path がシンボリックリンクでない場合や、リンクの読み取りに失敗した場合に発生します。
//emlist[例:][ruby]{
IO.write("testfile", "test")
File.symlink("testfile", "testlink") # => 0
File.readlink("testlink") # => "testfile"
//}... -
File
. symlink(old , new) -> 0 (27106.0) -
old への new という名前のシンボリックリンクを生成します。
...発生します。
@param old ファイル名を表す文字列を指定します。
@param new シンボリックリンクを表す文字列を指定します。
@raise Errno::EXXX 失敗した場合に発生します。
//emlist[例][ruby]{
File.symlink("testfile", "testlink") # => 0
//}... -
File
. symlink?(path) -> bool (27100.0) -
FileTest.#symlink? と同じです。
...
FileTest.#symlink? と同じです。
@param path パスを表す文字列か IO オブジェクトを指定します。... -
File
. unlink(*filename) -> Integer (24230.0) -
ファイルを削除します。削除したファイルの数を返します。 削除に失敗した場合は例外 Errno::EXXX が発生します。
...m filename ファイル名を表す文字列を指定します。
@raise 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
//}... -
File
. lstat(filename) -> File :: Stat (21297.0) -
File.statと同様ですが、シンボリックリンクに関してリンクそのものの 情報を File::Stat として返します。lstat(2) を実装していないシステムでは、File.stat と同じです。
...
File.statと同様ですが、シンボリックリンクに関してリンクそのものの
情報を File::Stat として返します。lstat(2) を実装していないシステムでは、File.stat と同じです。
@param filename ファイル名を表す文字列を指定します。
@ra......ise Errno::EXXX 情報の取得に失敗した場合に発生します。
//emlist[例][ruby]{
# link.rb は t.rb のシンボリックリンク
File.lstat("link.rb") == File.stat("t.rb") # => false
File.stat("link.rb") == File.stat("t.rb") # => true
//}
@see IO#stat, File#lstat... -
File
. lchown(owner , group , *filename) -> Integer (21158.0) -
File#chown と同様ですが、 シンボリックリンクに関してリンクそのもののオーナー、 グループを変更します。
...
File#chown と同様ですが、
シンボリックリンクに関してリンクそのもののオーナー、
グループを変更します。
@param filename ファイル名を表す文字列を指定します。
@param owner chown(2) と同様に数値で指定します。nil または -1......発生します。
//emlist[例][ruby]{
IO.write("testfile", "test")
File.symlink("testfile", "testlink")
File.chown(501, -1, "testfile")
File.lstat("testlink").ftype # => "link"
File.lchown(0, -1, "testlink")
File.stat("testlink").uid # => 501
File.lstat("testlink").uid # => 0
//}... -
File
. lchmod(mode , *filename) -> Integer (21152.0) -
File.chmod と同様ですが、シンボリックリンクに関してリンクそのものの モードを変更します。
...
File.chmod と同様ですが、シンボリックリンクに関してリンクそのものの
モードを変更します。
@param filename ファイル名を表す文字列を指定します。
@param mode chmod(2) と同様に整数で指定します。
@raise NotImplementedError lchmod(2)......生します。
//emlist[例][ruby]{
IO.write("testfile", "test")
File.symlink("testfile", "testlink")
File.lstat("testlink").ftype # => "link"
File.lchmod(0744, "testlink")
File.stat("testlink").mode.to_s(8) # => "100644"
File.lstat("testlink").mode.to_s(8) # => "120744"
//}... -
File
. ftype(filename) -> String (21148.0) -
ファイルのタイプを表す文字列を返します。
...のうちのいずれかです。File.lstat(filename).ftype と同じです。
シンボリックリンクに対して "link" を返します。
* "file"
* "directory"
* "characterSpecial"
* "blockSpecial"
* "fifo"
* "link"
* "socket"
* "unknown"
@param filename ファイル名を表す文......字列を指定します。
@raise Errno::EXXX 情報の取得に失敗した場合に発生します。
//emlist[例][ruby]{
File.ftype("testfile") # => "file"
File.ftype("/dev/tty") # => "characterSpecial"
File.ftype("/tmp/.X11-unix/X0") # => "socket"
//}... -
FileUtils
. # link(src , dest , options = {}) -> () (21101.0) -
src へのハードリンク dest を作成します。
...c:FileUtils#options
@raise Errno::EEXIST src が一つで dest がすでに存在しディレクトリでない場合に発生します。
@raise Errno::ENOTDIR src が複数で dest がディレクトリでない場合に発生します。
//emlist[][ruby]{
require 'fileutils'
FileUtils.ln......('gcc', 'cc', verbose: true)
FileUtils.ln('/usr/bin/emacs21', '/usr/bin/emacs')
FileUtils.cd('/bin')
FileUtils.ln(%w(cp mv mkdir), '/usr/bin')
//}...