0
0

More than 1 year has passed since last update.

ファイルを削除する、存在を確かめる

Posted at

ファイルを削除する

削除したファイルの数を返します。
削除に失敗した場合は例外 Errno::EXXX が発生します。

File.delete("ファイル名")   # => 1

ファイルの存在を確かめる

File.exist?("ファイル名")  # => true

感想

Fileクラスのメソッドを使うことができて嬉しい。
これからも頑張る。

出典

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0