Page 1 of 1

Get a sorted list of the files in Windows OneDrive.

Posted: 2024-Mar-07, 8:07 pm
by SweetTasha
A file that one needs to share with another device at the same physical location must be stored on OneDrive. Windows imposes a total 5GB limit for the files stored in OneDrive.

I need to get a list of all the files in OneDrive sorted by file size. To get the list using Windows File Explorer, I would need numerous executions--one for each level of subfolders. :o I'm hopeful that I can get that list with a lot fewer Command Prompt executions.

Thanks for your help,
SweetTasha.

Re: Get a sorted list of the files in Windows OneDrive.

Posted: 2024-Mar-08, 6:27 pm
by Simon Sheppard
You can get to the OneDrive synchronisation folder from the %OneDrive% variable

So

Code: Select all

dir /s %OneDrive%
or you can use Robocopy List:

Code: Select all

robocopy %OneDrive% c:\null /l /njh /njs 
This assumes all the files have been synced.

Re: Get a sorted list of the files in Windows OneDrive.

Posted: 2024-Mar-10, 10:31 pm
by SweetTasha
Thanks Simon.I used the robocopy example.
Phil/SweetTasha

Re: Get a sorted list of the files in Windows OneDrive.

Posted: 2024-Mar-28, 12:04 pm
by Patrick schlienger
It works for me too thanks

Re: Get a sorted list of the files in Windows OneDrive.

Posted: 2024-Apr-03, 2:36 am
by edwardsjethro
You can use Command Prompt or PowerShell to achieve this more efficiently. Here's a PowerShell command that lists all files in your OneDrive directory sorted by file size:

Code: Select all

Get-ChildItem -Path "$env:USERPROFILE\OneDrive" -Recurse | Where-Object {!$_.PSIsContainer} | Select-Object FullName, Length | Sort-Object Length -Descending