dbatools icon indicating copy to clipboard operation
dbatools copied to clipboard

Add filesize and last modified date on output in Find-DbaOrphanedFile

Open frodr1k opened this issue 1 year ago • 1 comments

Summarize Functionality

When gathering output from "Find-DbaOrphanedFile" it's a natural to also wanna know the potential diskspace saving opportunitys. As well as also getting an approximation of the files age.

Adding filesize in bytes (or optional in other sizes) will give a quick heads up of potential space saving.

Adding last modified date will help estimation if file SHOULD be removed in the next step.

Is there a command that is similiar or close to what you are looking for?

Yes

Technical Details

It's possible to do this but you need to loop through the results and do a separate look up.

Instead doing something similar to this would be nice to have as an option.

$a = (Get-Item -Path $filename) and then pulling all info from that. (pardon for my 5yearsold PS skills here) .

frodr1k avatar Jun 21 '23 16:06 frodr1k

We utilize T-SQL queries in gathering these details so at this time that is not something we can support as the stored procedures in SQL Server do not support returning those details.

In order to get what you are asking would require adding remote calls to the physical devices which changes who and how the command can be used. I think the output object of this command can easily be used by the user to obtain yourself what you are asking such as just doing Get-ChildItem for the RemoteFilename property.

wsmelton avatar Jun 21 '23 16:06 wsmelton