diff options
author | Norbert Preining <norbert@preining.info> | 2020-08-03 12:15:38 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-08-03 12:15:38 +0900 |
commit | 05d9e348e9ce7fb895782424da35d989a0396a44 (patch) | |
tree | e48802af5a9aebd6844d921d691c8bbd83063363 /texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1 | |
parent | ef9ddae5d03bd4cc3eceda25fbbccc37f1554e93 (diff) |
thorshammer (new)
Diffstat (limited to 'texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1')
-rw-r--r-- | texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1 | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1 b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1 new file mode 100644 index 00000000..7f7fcc3e --- /dev/null +++ b/texmf-dist/doc/latex/thorshammer/system-scripts/standalone/mkfolders.ps1 @@ -0,0 +1,60 @@ +$classPath="C:\Users\dpstory\Desktop\Test Folder\target\myClass" +# Create class folders +If ( $args.Length -eq 0 ) { + Write-Host "A CVS file of the class members is required," ` + "see documentation" + exit +} else { + $listName=$args[0] + if(Test-Path -Path ./$listName.csv) { + } else { + Write-Host "Cannot find the file `"$listName.csv`" in the current folder," ` + "check the spelling, do not include the extension." + exit + } +} +get-content "$listName.csv" | foreach { +$_ +">_Thor" -Replace ";","," } | Set-Content "commaList.csv" + +$argList=@() +get-content "commaList.csv" | %{ +# Write-Host "$_" + $split=$_.split(",") +# Write-Host $split[2] + $argList+=$split[2] +} +$currentPath=Convert-Path . +cd $classPath +Write-Host "Creating folder structure at `$classPath`"," ` + "with some exceptions" +for ($i=0; $i -lt $argList.length; $i++) { + $arg=$argList[$i] + $splitTwo=$argList[$i].split(">") + $firstName=$splitTwo[0] + $secondName=$splitTwo[1] + if ($firstName[0] -eq "*") { + $arg=$arg.substring(1) + $msg="Parsing the full path $arg" -Replace ">","/" + Write-Host $msg + Write-Host "Creating exceptional folders" + $firstName=$firstName.substring(1) +#Write-Host "$firstName" + Write-Host " Creating folder: $firstName" + New-Item $firstName -ErrorAction:Ignore -ItemType directory + $secondName=$firstName+"/$secondName" +#Write-Host "$secondName" + Write-Host " Creating folder: $secondName" + New-Item $secondName -ErrorAction:Ignore -ItemType directory + } else { + $msg="Parsing the relative path $arg" -Replace ">","/" + Write-Host $msg + Write-Host " Creating folder: $firstName" + New-Item $firstName -ErrorAction:Ignore -ItemType directory + cd $firstName + Write-Host " Creating subfolder of $firstName named: $secondName" + New-Item $secondName -ErrorAction:Ignore -ItemType directory + cd .. + } +} +cd $currentPath +Remove-Item commaList.csv |