Spring til indhold
For the complete documentation index, see llms.txt. This page is also available as Markdown.

PowerShell samples - creating folder structure from CSV file

Note at CSV fil skal være encoded i UTF-8 at understøtte særlig tegn.

Denne eksempel opretter en gruppe Mappe structure fra en CSV fil.

Sample

$csv = Import-Csv "c:\YourFolder\GroupFolder.csv"

foreach ($csvEntry in $csv) {
        $groupName = $csvEntry.Name

    # Extract the group folder name
    if ($groupName.Contains("\")) {
         $groupName = $groupName.Substring($groupName.LastIndexOf("\"), $groupName.Length - $groupName.LastIndexOf("\"))
         $groupName = $groupName.TrimStart("\")
        }

    # Create the group folder if it is not null, empty or fill in with space characters
    if (![]::IsNullOrWhiteSpace($groupName)) {
        $session = New-RDMSession -Type "Group" -Name $groupName
        $session.Group = $csvEntry.Name
        Set-RDMSession $session
        Write-Host "Group Folder $groupName created" -f Yellow
        }
}

Update-RDMUI

Noter

CSV fil skal have kun en kolonne med titlen sæt som Navn.

Fuld sti skal være angivet for hver under mappe.

Her er et eksempel af denne CSV fil:

Sidst opdateret

Var dette nyttigt?