-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate.js
36 lines (26 loc) · 868 Bytes
/
create.js
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
const fs = require('fs');
const name = ""; // name of the directory to be created
const raedmeTemplate =
`# ${name}
## Description
## Approach
## How to Use
1. **Compile**: \`g++ -o solution solution.cpp\`
2. **Run**: \`./solution\`
## Contact
If you have any questions, suggestions, or feedback, feel free to reach out to me:
- GitHub: [satendra03](https://github.com/satendra03)
- Email: [satendrakumarparteti.work@gmail.com](mailto:satendrakumarparteti.work@gmail.com)
Happy coding! 😊
`
function createFolderAndFiles(name) {
if (!name) {
console.error("Please provide a name for the folder.");
return;
}
fs.mkdirSync(name);
fs.writeFileSync(`${name}/README.md`, raedmeTemplate);
fs.writeFileSync(`${name}/solutions.cpp`, "");
console.log(`Folder "${name}" created successfully.`);
}
createFolderAndFiles(name);