ShareFile-PowerShell icon indicating copy to clipboard operation
ShareFile-PowerShell copied to clipboard

Copy-SFItem from 1 root folder to another

Open vsantoro opened this issue 3 years ago • 0 comments

I am trying to copy a root folder and all subfolders & files to another root folder. This works fine but only if the folder is empty. I tried using these switches -Force and -OverWrite, neither work. Anyone know how to get this to keep copying files even when there are already files there ? If they are there it should just skip, even an overwrite would work, just want to schedule this to run monthly but cant figure out a way to get it to go.

Add ShareFile PowerShell Snap-in

Add-PSSnapin ShareFile

#Run the following interactively to create a login token that can be used by Get-SfClient in unattended scripts #$sfClient = New-SfClient -Name ((Join-Path $env:USERPROFILE "Documents") + "\test.sfps") #-Account YourSubdomain $sfClient = Get-SfClient -Name ((Join-Path $env:USERPROFILE "Documents") + "\test.sfps")

#Create var $ProdFolders = "S:\Shared With Me\test1" $Backup = "S:\Shared With Me\test1archive"

#copy the test root folder to the test archive folder Copy-SFItem $ProdFolders $Backup

vsantoro avatar Jul 11 '22 18:07 vsantoro