Home Forums Programming Powershell How to target files in a certain sub dir with get-childitem RE: How to target files in a certain sub dir with get-childitem

  • Get-ChildItem D:\Data\Load -Directory | Get-ChildItem -Filter "*.zip" | Rename-Item -NewName {$_.name -replace ' ','-' } -whatif

    Get the folders, then within each folder get the ZIP files and for each ZIP file rename it.

    Think of each logical step and DON'T combine them to avoid side effects!!!

    Gaz

    -- Stop your grinnin' and drop your linen...they're everywhere!!!