Powershell - MoveFile

Powershell - MoveFile

ThomasRambach
Advisor Advisor
530 Views
0 Replies
Message 1 of 1

Powershell - MoveFile

ThomasRambach
Advisor
Advisor

I was using the powershell script to move all files from normal folders into new folders set as library folders. I tested this on a few folders where the file count was low and it worked perfectly. When I tried it on the folders with a few hundred files in each folder, it removed the old files but never copied to the new folder.

(Thankfully I tried this on our sandbox Vault first)

 

Why would this not work? Why did it totally delete the files? Using the coolOrange PowerVault.

Initialize-VDF


Open-VaultConnection -Vault "{Database}" -Server {Server} -User Administrator -Password "{Password}"
$fNewLibraryParent = $vault.DocumentService.GetFolderByPath("$/_Libraries/Content Center/en-US")
$foldLibraryParent = $vault.DocumentService.GetFolderByPath("$/Libraries/Content Center/en-US")


$folders = $vault.DocumentService.GetFoldersByParentId($foldLibraryParent.Id, 0)



$folders | ForEach-Object{
    $_.FullName


    $files = Get-VaultFiles -Folder $_.FullName
    $files | ForEach-Object {
    $vault.DocumentService.MoveFile($_.MasterId,$fOldLibraryParent.Id,$fNewLibraryParent.Id)
    $_.Name
    }


}
0 Likes
531 Views
0 Replies
Replies (0)