Skip to content

Instantly share code, notes, and snippets.

@Lehmancreations
Forked from jstrong013/Sync-SfItem_Example1.ps1
Last active December 6, 2019 18:24
Show Gist options
  • Save Lehmancreations/41711507e9566f1192359f7aa92cff52 to your computer and use it in GitHub Desktop.
Save Lehmancreations/41711507e9566f1192359f7aa92cff52 to your computer and use it in GitHub Desktop.
Example Code for Sync-SfItem - Citrix Community Answer
# Answers question Generated here: https://community.sharefilesupport.com/citrixsharefile/topics/sync-sfitem-command-not-working
Add-PSSnapin ShareFile
$sfClient = Get-SfClient -Name "$env:Temp\sfclient.sfps"
New-PSDrive -Name sfDrive -PSProvider ShareFile -Client $sfClient -Root "\"
# Name Used (GB) Free (GB) Provider Root
# ---- --------- --------- -------- ----
# sfDrive ShareFile \
Sync-SfItem -LocalPath "C:\PowerShell\ShareFile\TEST\*.txt" -Upload -ShareFilePath "sfDrive:\Folder Example" -OverWrite
# Sync operation successfully completed.
Remove-PSDrive -Name sfDrive
Remove-Item -Path "$env:Temp\sfclient.sfps" -Force
# The Sharefile folder can either point to a personal folder or a shared one. just use the name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment