| サンプル集 |
|
■VC ■C# ■Java ■BorlandC ■LinuxC ■MS-DOS ■bash ■Excel VBA ■VBScript ■PHP ■HTML ■perl ■iPhone ■Android ■Lua ■other |
| Linuxコマンド |
| 用語集 |
| debian メモ |
| apache2 メモ |
| MySQL メモ |
| Oracle メモ |
| HOME |
ディレクトリの内容を取得して表示します。
◆環境| OS | Windows 7 Professional Service Pack 1 64bit |
|---|---|
| C# | Microsoft Visual C# 2010 01018-587-4111284-70817 |
[ファイル]-[新規作成]-[プロジェクト]を選択。
[コンソール アプリケーション]を選択し、名前に「MyDIR」と入力し「OK」。
ディレクトリに配下にある情報は以下のメソッドで取得します。
| ディレクトリの情報 | System.IO.Directory.GetDirectories |
| ファイルの情報 | System.IO.Directory.GetFiles |
| Program.cs | ||
|
カレントディレクトリの内容と、1階層上のディレクトリの内容を表示してみます。
> MyDIR.exe .
file .\MyDIR.exe
> MyDIR.exe ..
dir ..\exe
dir ..\src
file ..\copyResource.bat
file ..\makeHTML.bat
file ..\YMWCS137-main.txt
file ..\YMWCS137.html
file ..\YMWCS137.txt
file .\MyDIR.exe
> MyDIR.exe ..
dir ..\exe
dir ..\src
file ..\copyResource.bat
file ..\makeHTML.bat
file ..\YMWCS137-main.txt
file ..\YMWCS137.html
file ..\YMWCS137.txt
ディレクトリの内容を取得できました。
Copyright (C) 2015 ymlib.com
