Created
October 26, 2010 19:19
-
-
Save rtipton/647585 to your computer and use it in GitHub Desktop.
C# -- Write a File Listing to a txt File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
using System.IO; | |
namespace CheckUploadH | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
string targetFile = @"O:\Work\Remits\uploadh_log.TXT"; | |
StreamWriter sw; | |
sw = File.AppendText(targetFile); | |
string directoryToCheck = @"U:\"; | |
string[] dirs = Directory.GetFiles(directoryToCheck, "*.835"); | |
sw.WriteLine(DateTime.Now); | |
sw.WriteLine("-"); | |
foreach (string dir in dirs) | |
{ | |
Console.WriteLine(dir); | |
sw.WriteLine(dir); | |
} | |
sw.WriteLine("==========================================================="); | |
sw.Close(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment