web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Power Automate Desktop...
Power Automate
Answered

Power Automate Desktop can't recurse my C:\ to get a list of files --Something about Recycle Permissions

(0) ShareShare
ReportReport
Posted on by 282

Just not sure what to adjust to get my list of files from my C: Drive.

 

Error Message: 

Microsoft.Flow.RPA.Desktop.Modules.SDK.ActionException: Can't retrieve list of files in folder C:\. ---> System.UnauthorizedAccessException: Access to the path 'C:\$Recycle.Bin\S-1-5-18' is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileSystemEnumerableIterator`1.AddSearchableDirsToStack(SearchData localSearchData)
at System.IO.FileSystemEnumerableIterator`1.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.IO.DirectoryInfo.InternalGetFiles(String searchPattern, SearchOption searchOption)
at Microsoft.Flow.RPA.Desktop.Modules.Folder.Actions.FolderActions.GetFilesInFolder(Variant folder, Variant fileMask, Variant& listOfFiles, Boolean includeSubfolders, Boolean getResultInDataTable, String resultDataTableColumns, Boolean failOnAccessDenied)
--- End of inner exception stack trace ---
at Microsoft.Flow.RPA.Desktop.Modules.Folder.Actions.GetFilesInFolder.Execute(ActionContext context)
at Microsoft.Flow.RPA.Desktop.Robin.Engine.Execution.ActionRunner.Run(IActionStatement statement, Dictionary`2 inputArguments, Dictionary`2 outputArguments)

 

 

I have the same question (0)
  • Nived_Nambiar Profile Picture
    18,138 Super User 2026 Season 1 on at

    Hi @sonisick 

     

    May i get more information on what you are trying to do ?

  • sonisick Profile Picture
    282 on at

    I was just trying to modify a sample program for removing empty files in a directory. I modified it to use subdirectories. Even though I'm the Admin on the machine, there may be special subdirectories you can't recurse like the Recycle Bin. I chose the C drive.

  • Verified answer
    momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    There are some special folders that you can't enumerate - there is a thread on this forum about this where I OP listed what some of these are under user home folder, that's the same case.

    So basically, what you need to do is:

     

    1. Get folder list under C: but not subfodlers

    2. Remove restricted folders

    3. Use the list to enumarate subfolders

  • sonisick Profile Picture
    282 on at

    That makes sense because the first folder it hit the "Recycle Bin" is a special folder.

  • sonisick Profile Picture
    282 on at

    I'm assuming the folder that see when I go into explorer or get a listing from PowerShell are the non-restricted that I need to enumerate through?

  • momlo Profile Picture
    1,527 Super User 2024 Season 1 on at

    Not really, some are visible but still protected. I did not investigate the reason why they are protected, if not OS natvie implementation, then maybe OneDrive backup redirection or AV malware protection.

     

    This is the post. I suggested looking into xcopy to the OP as the purpose was to backup user's home folder, and xcopy imaho is much better solution and can be integrated with PAD too.

     

    https://powerusers.microsoft.com/t5/Power-Automate-Desktop/How-do-I-Filter-Out-Items-from-Get-subfolders-in-Folder-menus-in/m-p/2025337/highlight/true#M23385

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 253 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 172 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 134 Super User 2026 Season 2

Last 30 days Overall leaderboard