Comments (5)
Hi @rwinhold , it's definitely an issue within the provider. There are two sets of operations that occur the actual download and the delete from ShareFile. The issue that is surfacing is the provider does not track distinct items that are being downloaded. Therefore, after download it naively deletes the whole ShareFile path. Until we get this fixed, I don't see a workaround short of having to implement the download and delete behavior with the tracking mentioned.
from sharefile-powershell.
Thanks for the reply. I was wondering if I was going crazy or if there was a problem.
It appears that if I specify an exact filename, then it will download it and delete it without deleting the whole directory content. I think what I'll attempt as a "workaround" is to try to generate a list of what I want to download and move them one at a time.
from sharefile-powershell.
Here's a bit of code showing what I did to solve my problem. It runs quite slow but if I schedule a task to run this fairly often, the number of files doesn't get to large and the run time is acceptable:
$CredentialFile = "C:\sharefilescript\credentials.sfps"
$sfClient=Get-SfClient -Name $CredentialFile
$localRootDir = "c:\moveFilesToHereROOT"
$RootSharefileDir = "xxxxxxxx-xxxxx-xxxx-xxxx-xxxxxxxxxxxx" #from URL of actual root dir
$childDir = Send-SfRequest $sfClient -Method GET -Entity Items -Id $RootSharefileDir -Expand "Children,Owner"`
foreach($dir in $childDir.Children)
{
$dirname = $dir.filename
$file = Send-SfRequest $sfClient -Method GET -Entity Items -Id $dir.id -Expand "Children,Owner"
foreach($fileToMove in $file.children)
{
$FileToMove = (Send-SfRequest $sfClient -Entity Items -id $fileToMove.id).url
New-PSDrive -Name sfmoveFile -PSProvider Sharefile -Client $sfClient -Root "/" -RootUri $FileToMove
Sync-SfItem -ShareFilePath "sfmoveFile:" -Download -OverWrite -Move -LocalPath "$localRootDir\$dirname"
Remove-PSDrive sfmoveFile
}
}
from sharefile-powershell.
@rwinhold I've opened up a PR that should resolve the issue. There is still some testing to be done to make sure my late night boredom paid off.
from sharefile-powershell.
Cool! Thanks!
from sharefile-powershell.
Related Issues (20)
- cannot remove access
- Upload File to ShareFile Link
- New-SFClient Error: (400) Bad Request when using -Credential -Account HOT 1
- Help with identifying "paths" > 256 chars HOT 2
- Some documents don't upload using Powershell HOT 1
- PowerShell SDK TLS Error
- Sync-SfItem System.IO Error
- Download file without passing sharefile account credentials
- There is an error in UploadLocalFiles.ps1
- Folder stopped syncing: Get-SfClient : Object reference not set to an instance of an object. HOT 1
- Add compatibility for Powershell Core and make this snap-in a module HOT 1
- Sync-SfItem does not remove deleted from ShareFile files at LocalPath HOT 1
- Send-SfRequest : BadRequest: User must be added as an employee. HOT 2
- Copy-sfitem exclude items
- DisabledUsers.ps1 bug
- Copy-SFItem from 1 root folder to another
- Create Report SaveToFolder Not Working
- New-SFClient Fails for ShareFile Application Specific Password HOT 1
- Sync-SfItem Folder is deleted when - KeepFolders and -Move are used HOT 1
- Sync-SfItem : The client does not have the requested scopes the endpoint requires
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sharefile-powershell.