V
V
Vladimir Kulikov2021-05-05 15:35:16
PowerShell
Vladimir Kulikov, 2021-05-05 15:35:16

How to create a folder with files with a specific name in powershell?

Hello!
How to create a folder with files with a specific name in powershell?

For example, the name test. A folder with files will be created:

-test
--_test.sass
--test.pug

In the file "_test.sass" the text ".test";
In the file "_test.pug" the text "section.test";

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2021-05-05
@vabka

function create_component_directory([System.String] $name) {
    New-Item -ItemType directory $name
    $sass = "$name/_$name.sass"
    $pug = "$name/$name.pug"
    ".$name" >> $sass
    "section.$name" >> $pug
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question