37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Recursive_Directory_Lister
|
|
{
|
|
internal class Program
|
|
{
|
|
static void Main(string[] args)
|
|
{
|
|
if(args.Length < 1)
|
|
{
|
|
// 디렉토리 경로가 args로 필요합니다를 영작
|
|
Console.WriteLine("A directory path is required as an argument.");
|
|
return;
|
|
}
|
|
|
|
|
|
var lists = System.IO.Directory.GetDirectories(args[0], "*", System.IO.SearchOption.AllDirectories);
|
|
foreach(var list in lists)
|
|
{
|
|
Console.WriteLine(list);
|
|
}
|
|
|
|
Console.WriteLine("If you want to print the message below, please enter the file name (if not, it will not be printed).");
|
|
Console.Write("FileName : ");
|
|
string fileName = Console.ReadLine();
|
|
if(!string.IsNullOrEmpty(fileName.Trim()))
|
|
{
|
|
System.IO.File.WriteAllText(fileName, string.Join(Environment.NewLine, lists));
|
|
}
|
|
}
|
|
}
|
|
}
|