using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Renci.SshNet;
namespace GetFileNames
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();

textBox1.Text = @"";//文件路径
textBox2.Text = "";//格式
}

string _outFileName = "";

private void button1_Click(object sender, EventArgs e)
{

DirectoryInfo folder = new DirectoryInfo(textBox1.Text);

foreach (FileInfo file in folder.GetFiles(textBox2.Text))
{
richTextBox1.AppendText("node "+file.Name+'\n');
}

OutputFile(textBox1.Text + @"\"+ _outFileName, richTextBox1.Text);
}

void OutputFile(string strFilePath,string strContent)
{
StreamWriter swOut = new StreamWriter(strFilePath, false, Encoding.Default);
swOut.WriteLine(strContent);
swOut.Flush();
swOut.Close();
}

}
}