-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectoryFileTreeGenerator.linq
More file actions
71 lines (64 loc) · 1.75 KB
/
DirectoryFileTreeGenerator.linq
File metadata and controls
71 lines (64 loc) · 1.75 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<Query Kind="Statements" />
string baseDirectory =
"""
C:\Games\ewdlop\Bots
""";
// Define the directory structure and files
Dictionary<string, string[]> structure = new Dictionary<string, string[]>
{
{"src/bot", new[] {"TaskManagerBot.js"}},
{"src/bot/dialogs", new[] {"index.js", "taskDialog.js"}},
{"src/cards", new[] {"taskCard.json", "reminderCard.json"}},
{"src/services", new[] {
"googleCalendarService.js",
"outlookService.js",
"notificationService.js"
}},
{"src/utils", new[] {"logger.js", "dateHelper.js"}},
{"src", new[] {"app.js"}},
{"tests", new[] {"bot.test.js", "taskDialog.test.js"}},
{"", new[] {".env", "package.json", "README.md", "index.js"}}
};
try
{
// Create base directory if it doesn't exist
if (Directory.Exists(baseDirectory))
{
Console.WriteLine($"Warning: Directory '{baseDirectory}' already exists. Continuing anyway...");
}
else
{
Directory.CreateDirectory(baseDirectory);
Console.WriteLine($"Created base directory: {baseDirectory}");
}
// Create directories and files
foreach (var entry in structure)
{
string fullPath = Path.Combine(baseDirectory, entry.Key);
// Create directory if it's not empty
if (!string.IsNullOrEmpty(entry.Key))
{
Directory.CreateDirectory(fullPath);
Console.WriteLine($"Created directory: {fullPath}");
}
// Create files
foreach (string file in entry.Value)
{
string filePath = Path.Combine(fullPath, file);
if (!File.Exists(filePath))
{
File.Create(filePath).Close();
Console.WriteLine($"Created file: {filePath}");
}
else
{
Console.WriteLine($"Warning: File already exists: {filePath}");
}
}
}
Console.WriteLine("\nDirectory structure created successfully!");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}