Upload using PowerShell without creating a new folder

  • 1
  • Question
  • Updated 2 years ago

I'm trying to convert SFCLI language over to Powershell and am a complete novice on the coding.  I've got most of the coding transitioned but I’m trying to determine how to upload to Sharefile without creating a new folder.  For example, the following script creates a new folder called “Sample, Bob and Betty” under Invoices.  I just want the documents to upload to the Invoices folder, not create a new folder.

 Sync-SfItem –LocalPath  "C:\Users\jason\Desktop\Invoices\Sample, Bob and Betty\” -upload -ShareFilePath "/Private Client Documents/Sample, Bob and Betty/Invoices/”

Photo of Jason


  • 1 Post
  • 0 Reply Likes

Posted 2 years ago

  • 1
Photo of Luke Skrzypek

Luke Skrzypek, Software Engineer

  • 76 Posts
  • 8 Reply Likes
Hi Jason,

To accomplish that behavior you can add a wildcard character to the end of your -LocalPath. So it will look like this:
Sync-SfItem –LocalPath  "C:\Users\jason\Desktop\Invoices\Sample, Bob and Betty\*” -upload -ShareFilePath "/Private Client Documents/Sample, Bob and Betty/Invoices/”
That will upload all the files in your local folder to the Invoices folder in ShareFile. The way you have it currently uploads the folder itself, and all of its contents.