Skip to content
This repository has been archived by the owner on Jun 25, 2024. It is now read-only.

Add-DatabricksDBFSFile does not support uploading hidden files in Powershell Core #199

Open
alexpilon666 opened this issue Jun 21, 2022 · 0 comments

Comments

@alexpilon666
Copy link

alexpilon666 commented Jun 21, 2022

Hello,

By default in Windows Powershell (Powershell v5.x), the Get-ChildItem command returns all files, including hidden ones.
When moving to Powershell Core (Powershell v7.x), the Get-ChildItem only returns standard files, and not hidden files anymore. To also show hidden files you need to add the -Force switch (there's a -Hidden switch, but this will only show hidden files, which is not the way to go).

This causes an issue where uploading hidden files cannot be done using the Add-DatabricksDBFSFile command, and in our case, breaks our workflow as we regularly upload .env files containing secrets and other environment variables, and we've just switched over from Windows Powershell to Powershell Core.

I've created this PR to add the -Force switch in the Add-DatabricksDBFSFile.ps1 to fix this. It has been tried locally and works like a charm.
Adding the -Force switch in Windows Powershell will not break anything, as it does the exact same thing as in Powershell Core as it does in Windows Powershell.

Thanks, and let me know if there are any concerns with this fix!

alexpilon666 pushed a commit to alexpilon666/azure.databricks.cicd.tools that referenced this issue Jun 21, 2022
By default in Windows Powershell (Powershell v5.x), the 'Get-ChildItem' command returns all files, including hidden ones.
When moving to Powershell Core (Powershell v7.x), the 'Get-ChildItem' only returns standard files, and not hidden files anymore. To also show hidden files you need to add the '-Force' switch (there's a '-Hidden' switch, but this will only show hidden files, which is not the way to go).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant