Message 1 of 1
Powershell - MoveFile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
}
}