1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

フォルダにあるファイルの一覧をコピー(列挙)する

Last updated at Posted at 2015-07-02

[Windows]フォルダにあるファイルの一覧をコピー(列挙)する

たまにメールとかで、
 「そのディレクトリにあるファイル(名)を教えて下さい。」
と聞くと、頑張って写経する人がいる。

欲しいフォルダのカレントディレクトリまで移動(※方法は<補足>に記載)し、以下をコマンドラインで実行して貼り付けして欲しい。

dir /B | clip

※clipはあまり有名じゃない様ですが、クリップボードに値を入れるコマンドです。

サブディレクトリのファイルも含めて必要であれば、$/s$を追加して以下実行して貼り付けして下さい。

dir /B /S | clip

<補足>コマンドラインの実行方法

Windowsの人は、

1. [ファイル名を指定して実行]ダイアログボックスを開く

Windowsマーク+R

2. cmdと入力してEnter

3. 取得したいディレクトリへの絶対パスをコピーして以下のよう移動
例えば、C:\tempディレクトリに移動したいのであれば、以下のように打ち込んでEnter

cd "C:\temp"

4. あとは、本文の以下コマンドを打ちこんで下さい。

dir /B | clip
1
3
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
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?