If I got you right you’re not looking for the relative path you’re looking for the absolute path. You can search/list files with Get-ChildItem. To select the object properties you’re after you can use Select-Object and the Property you need should be the FullName.
Please always read the complete help including the examples for the cmdlets you use to learn how to use them.
[quote quote=195977]If I got you right you’re not looking for the relative path you’re looking for the absolute path. You can search/list files with Get-ChildItem. To select the object properties you’re after you can use Select-Object and the Property you need should be the FullName.
Please always read the complete help including the examples for the cmdlets you use to learn how to use them.
[/quote]
I did, but after fev hours I give up, it didn’t work, it is relative path, because I can not use fullpath
AFAIK There’s no built-in option for that. You would need to create a function checks for empty folders and deletes them. You could try to find something fitting in the PowershellGallery or so.
Doing it like this could be dangerous because if there is a subfolder with an item in it, but not the folder that is being searched it would delete all of the items inside. This should get you started on what you are looking for though.
You are allowed to spend a little effort yourself and search for a solution. It takes seconds to type “powershell remove empty folder” in the google search and the first hit will teach you everything you need: How to recursively remove all empty folders in PowerShell?
With Powershell it is allowed to sneak in other peoples script and use what you need. That’s why we all share it in places like Powershell.org or StackOverflow or Microsoft Technet.
Using Get-ChildItem you have to be careful to use the -Recurse or you’re only counting the files under the parent folder. Another simple count method is to use an old COM object from vbScript which is typically faster than recusion with Get-ChildItem: