Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start-gsdrivefileupload recurse function doesn't place the files in the correct parent directory #235

Open
TheEZ12c opened this issue Sep 25, 2019 · 15 comments
Assignees
Labels

Comments

@TheEZ12c
Copy link

TheEZ12c commented Sep 25, 2019

Describe the bug
When using the start-psdrivefileupload function with the recurse switch, it will create the folder structure of the directory to be uploaded, but then it places all of the files in the root directory.

To Reproduce
Steps to reproduce the behavior:

  1. Use start-gsdrivefileUpload
  2. Use recurse switch

Expected behavior
In the documentation it states that it should place the files in the same directory pattern in Google as the original directory

Environment (please complete the following information):

  • OS: Windows 10 1803
  • PowerShell Version: Powershell 5.1.17763.592
  • PSGSuite Version: 2.32.3
@scrthq scrthq self-assigned this Sep 25, 2019
@scrthq
Copy link
Member

scrthq commented Sep 25, 2019

👀 checking this out, thanks @TheEZ12c ! Just to confirm, you're not passing a value to the Parents parameter on Start-GSDriveFileUpload, right?

@TheEZ12c
Copy link
Author

TheEZ12c commented Sep 25, 2019 via email

@scrthq scrthq added the bug label Sep 25, 2019
@scrthq
Copy link
Member

scrthq commented Sep 25, 2019

alright, seeing if I can replicate and will let you know! If you have a sample of the full command you're running with anything sensitive redacted, that would be helpful!

@TheEZ12c
Copy link
Author

TheEZ12c commented Sep 25, 2019 via email

@scrthq
Copy link
Member

scrthq commented Oct 6, 2019

Hey @TheEZ12c - The only way I'm able to replicate this is if I pass a bad ParentId to the Parents parameter, at which point all of the subfolders are created directly under the root of the Drive.

How are you pulling the parent ID of the folder that you're trying to upload to?

The easiest way to get the folder ID of the parent folder is to open the folder in Drive, then grab the ID from the URL. Your URL should look something like this with the bold section highlighting the folder ID you would want to pass to the Parents parameter:

https://drive.google.com/drive/u/0/folders/ 1CyslrEPaPt3YPehPUFFNRmQOrPzrSQ_7

Your call to upload a recursive folder structure should look something like this:

Start-GSDriveFileUpload -Path .\PSGSuite\Public -Parents '1CyslrEPaPt3YPehPUFFNRmQOrPzrSQ_7' -Recurse -Wait -Verbose

If you enable Verbose, you should see something like the following:

image


Also FYI - I need to remove the Name parameter from the function as it currently doesn't do anything after reviewing the code and wouldn't make sense anyway when uploading a recursive folder/file structure, tbh.

scrthq added a commit that referenced this issue Oct 6, 2019
## 2.33.1 - 2019-10-06

* [Issue #235](#235)
    * Removed: `Name` parameter from `Start-GSDriveFileUpload` as it was unused in the function and doesn
scrthq added a commit that referenced this issue Oct 6, 2019
## 2.33.1 - 2019-10-06

* [Issue #235](#235)
    * Removed: `Name` parameter from `Start-GSDriveFileUpload` as it was unused in the function and doesnt make sense when uploading an array of files.
* [Issue #238](#238)
    * Added: `Get-GSDataTransfer` to Get/List current Data Transfers
* [Issue #239](#239)
    * Removed: `Update-GSResource` `Id` parameter as it was non-applicable (duplicate of `ResourceId` and not writable per API docs)
    * Cleaned up function help and examples to match changes
* [Issue #240](#240)
    * Fixed: `Get-GSCalendar` now properly resolves single calendar metadata retrieval and passes List requests to `Get-GSCalendarSubscription` since the `Calendars` service does not support List requests.
* Miscellaneous
    * Updated Google .NET SDKs to latest versions
    * Cleaned up build.ps1 script
scrthq added a commit that referenced this issue Oct 6, 2019
## 2.33.1 - 2019-10-06

* [Issue #235](#235)
    * Removed: `Name` parameter from `Start-GSDriveFileUpload` as it was unused in the function and doesnt make sense when uploading an array of files.
* [Issue #238](#238)
    * Added: `Get-GSDataTransfer` to Get/List current Data Transfers
* [Issue #239](#239)
    * Removed: `Update-GSResource` `Id` parameter as it was non-applicable (duplicate of `ResourceId` and not writable per API docs)
    * Cleaned up function help and examples to match changes
* [Issue #240](#240)
    * Fixed: `Get-GSCalendar` now properly resolves single calendar metadata retrieval and passes List requests to `Get-GSCalendarSubscription` since the `Calendars` service does not support List requests.
* Miscellaneous
    * Updated Google .NET SDKs to latest versions
    * Cleaned up build.ps1 script
@TheEZ12c
Copy link
Author

TheEZ12c commented Oct 6, 2019 via email

@scrthq
Copy link
Member

scrthq commented Oct 7, 2019

Gotcha! That Shared Drive bit definitely helps! Let me test and see if I can replicate, could absolutely be a Shared Drive issue since the underlying Request objects for Drive SDK need to be flagged as supporting Shared Drives specifically. Digging in once more!

@scrthq
Copy link
Member

scrthq commented Oct 7, 2019

Just to confirm @TheEZ12c - Do the files get uploaded to a Shared Drive folder, just not in the correct, new folder structure? or do the folders get created in the Shared Drive, but the files are uploaded to the root of My Drive?

@scrthq
Copy link
Member

scrthq commented Oct 7, 2019

So the odd part for me is that it also appears to be working fine with a Shared Drive. Testing - PSGSuite is a Shared Drive which I pointed my test at as the Parent, path was set to the Public folder of the PSGSuite functions in this repo:

image

@scrthq
Copy link
Member

scrthq commented Oct 7, 2019

Tried a subfolder in a Shared Drive as well, still working fine for me :-(

image

@TheEZ12c
Copy link
Author

TheEZ12c commented Oct 7, 2019 via email

@scrthq
Copy link
Member

scrthq commented Oct 7, 2019

Testing with the latest version (2.33.2), but there hasn't been any code changes to the logic that determines where to upload a file to in a while.

If you run with Verbose, that might illuminate some issues potentially. I'm assuming you're not seeing any errors either at any point?

@TheEZ12c
Copy link
Author

TheEZ12c commented Oct 7, 2019 via email

@scrthq
Copy link
Member

scrthq commented Oct 7, 2019

hmmm I don't think it would, since it's only looking at the source folder itself, not the full path to it, when pulling that info... it may break it though... I can try and replicate from my end as well

@scrthq
Copy link
Member

scrthq commented Oct 19, 2019

hey @TheEZ12c - still haven't had a chance to test this further with a UNC path, I'll let you know once I'm able to though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants