Form1の全コード
using System;
using System.Windows.Forms;
using System.IO;
using System.Collections.ObjectModel;
using Microsoft.VisualBasic.FileIO;
namespace FileExplorer
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void browseButton_Click(object sender, EventArgs e)
{
int i;
if (FolderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
ReadOnlyCollection fileNames = FileSystem.GetFiles(FolderBrowserDialog1.SelectedPath, Microsoft.VisualBasic.FileIO.SearchOption.SearchAllSubDirectories, "*.*");
String OutText = "Size:bytes " + "\t" + "Modified: " + "\t" + "File: " + "\r\n";
for (i = 0; i < fileNames.Count; i++)
{
System.IO.FileInfo thisFile = FileSystem.GetFileInfo(fileNames[i]);
OutText = OutText + thisFile.Length.ToString() + "\t" + thisFile.LastWriteTime.ToString() + "\t" + thisFile.FullName + "\r\n";
}
if (SaveFileDialog1.ShowDialog() == DialogResult.OK)
{
using (StreamWriter outfile = new StreamWriter(SaveFileDialog1.FileName))
{
outfile.Write(OutText);
}
}
}
}
}
}