Copying files with the Powershell SDK

  • 1
  • Question
  • Updated 1 week ago

I am trying to copy files within ShareFile.  If I use
named paths I can get it to work with the copy-sfItem call.  Unfortunately what I am dealing with is the item IDs. How do I make a copy call with item IDs or how can I get the actual directory path given an item ID?

 

dd-PSSnapIn ShareFile

$sfClient = Get-SfClient -Name "$HOME\Documents\OurDomain.sfps"

New-PSDrive -Name sf -PSProvider ShareFile -Root / -Client $sfClient

Copy-SFItem -Path sf:"/Shared Folders/IT/test/From/Adobe Acrobat" -Destination sf:"/Shared Folders/IT/test/To/"  ***This works***



$FromShareFileFolder = (Send-SfRequest $sfClient -Entity Items -Id (ID From Browser))

$FromShareFileFolderUrl = $FromShareFileFolder.Url

$FromShareFilePath = $FromShareFileFolderUrl.AbsolutePath

$ToShareFileFolder = (Send-SfRequest $sfClient -Entity Items -Id (ID From Browser))

$ToShareFileFolderUrl = $ToShareFileFolder.Url

$ToShareFilePath = $ToShareFileFolderUrl.AbsolutePath

Copy-SfItem -Path sf:$FromShareFilePath -Destination sf:$ToShareFilePath      *** This does not work***

 

Any advice would be helpful
Photo of Paul Lyon

Paul Lyon

  • 1 Post
  • 0 Reply Likes

Posted 1 week ago

  • 1

Be the first to post a reply!