AzureDevOps — List files and folders

Cosmin Vladutu
1 min readMay 17, 2022

Problem

After creating my new beautiful pipeline in AzureDevops, I lost some files I needed to use (basically I forgot to publish them). After the building steps, I had some publishing that I needed to do: the actual website I wanted to deploy, some PowerShell files and some DLLs I wanted explicitly to run. Ohh well…my PowerShell files weren’t around, and I am pretty sure you know how hard it is to find things on the agents…

Fix

Create another PowerShell step in the pipeline that prints everything from a specific location. Easy to say, hard to do since I didn’t find any example just to copy-paste on the first links I found on Google. If I didn’t find any, and now I found out how to do it, I wanted to share this info, maybe others will need it (I am pretty sure I will also need it in the future)

PowerShell — Azure DevOps step in pipeline — print all content of a folder

If you aren’t using the classic way of creating pipelines and you are using yaml files you can use the next yml step:

- powershell: |Write-Host "Show all folder content ArtifactStagingDirectory"Get-ChildItem -Path $(Build.ArtifactStagingDirectory)\*.* -Recurse -ForceerrorActionPreference: continuedisplayName: 'PowerShell Script List folder structure'continueOnError: true

Be careful with the indentation!

--

--

Cosmin Vladutu

Software Engineer | Azure & .NET Full Stack Developer | Leader