指定フォルダのファイルリストをテキストで取得したい

こんにちは。
System.IO.Directory.GetFiles(“フォルダパス”)
で指定フォルダのファイルリストが取れると聞いたため
メッセージボックスアクティビティに下記の構文を貼り付けて実行したら
System.IO.Directory.GetFiles(“C:\Users(ユーザ名)\Desktop”).ToList.ToString
添付画像が表示されてしまいました。
"C:\Users(ユーザ名)\Desktop"のファイルリストをテキストで取得するにはどうすればよいでしょうか?

encoding

Hi @gorby

Try this inside message box.

String.Join(“;”,System.IO.Directory.GetFiles(“C:\Users(username)\Desktop”).toArray)

2 Likes

こんにちは

これでは取得できません。いったん文字列配列で受けて、それを処理してください。

files = System.IO.Directory.GetFiles(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory))

すべてのファイルを一つの文字列にするならSrting.Join
ここに取り出すならForEachでいてレートしてください

filesは文字列配列です。

Sequence.xaml (6.3 KB)

Hi @gorby

If you have just 1 file in the list you can access to that particular item with

System.IO.Directory.GetFiles("yourPath")(0)

if you want to print one by one then use a for each activity to loop through the items and print each item

if you want all in one in a message box then use

String.Join(",", yourFilesList)

Regards!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.