forked from hphan9/shinny-ssg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Subfolder.cs
33 lines (31 loc) · 1.01 KB
/
Subfolder.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace shinny_ssg
{
class Subfolder
{
//recursive method
public void createFolder(string parent, string des, string css)
{
DirectoryInfo dSource = new DirectoryInfo(parent);
DirectoryInfo dDestination = new DirectoryInfo(des);
//Getting only text files
foreach(FileInfo f in dSource.GetFiles("*.txt") )
{
var src = $"{dSource.FullName}\\{f.Name}";
FileText temp = new FileText(src, des, css);
temp.saveFile();
Console.WriteLine(src);
}
//check all the folder
foreach(DirectoryInfo subDir in dSource.GetDirectories())
{
var name = subDir.Name;
var newdir= dDestination.CreateSubdirectory($"{name}");
createFolder(subDir.ToString(), newdir.FullName, css);
}
}
}
}