Coder Social home page Coder Social logo

Comments (5)

rgmills avatar rgmills commented on August 10, 2024

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.

rwinhold avatar rwinhold commented on August 10, 2024

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.

rwinhold avatar rwinhold commented on August 10, 2024

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.

rgmills avatar rgmills commented on August 10, 2024

@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.

rwinhold avatar rwinhold commented on August 10, 2024

Cool! Thanks!

from sharefile-powershell.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.