Start a new topic
Answered

Import Folder structure using PowerShell

I'm trying to create a script that will just create folders and subfolders. I can create folders but what is the syntax to create a subfolder?


$folder = New-RoyalObject -Type RoyalFolder -Folder $royalDocument -Name "TestFolder" -Description "Test"


This will create the folder, how do I create a subfolder below this?


Best Answer

Never mind, I found out how to do this. For those wondering here is how:


#create a RoyalStore in memory

$royalStore = New-RoyalStore -UserName <username>

#create a RoyalDocument in memory

$documentName = "testdocument"

$documentPath = "c:\users\<profile name>\documents\new.rtsz"

$royalDocument = Open-RoyalDocument -Store $royalStore -FileName $documentPath

#create folders

$folder1 = New-RoyalObject -Type RoyalFolder -Folder $royalDocument -Name "Test" -Description "Test"

$folder2 = New-RoyalObject -folder $folder1 -Type RoyalFolder -Name "Subfolder"

Out-RoyalDocument -Document $royalDocument

 

 

 

1 Comment

Answer

Never mind, I found out how to do this. For those wondering here is how:


#create a RoyalStore in memory

$royalStore = New-RoyalStore -UserName <username>

#create a RoyalDocument in memory

$documentName = "testdocument"

$documentPath = "c:\users\<profile name>\documents\new.rtsz"

$royalDocument = Open-RoyalDocument -Store $royalStore -FileName $documentPath

#create folders

$folder1 = New-RoyalObject -Type RoyalFolder -Folder $royalDocument -Name "Test" -Description "Test"

$folder2 = New-RoyalObject -folder $folder1 -Type RoyalFolder -Name "Subfolder"

Out-RoyalDocument -Document $royalDocument

 

 

 

Login or Signup to post a comment