Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

How to target files in a certain sub dir with get-childitem

$
0
0
Hi All, So I have a list of directories:D:\Data\Load\customer1\ArchiveD:\Data\Load\customer2\ArchiveD:\Data\Load\customer3\ArchiveD:\Data\Load\customer4\ArchiveWe receive files with spaces and i want to replace those spaces with dashes, but i want to only target items in the archive directories.Im using this but cant find the command to make it only look files in the archive folderGet-ChildItem D:\Data\Load -Filter "*.zip" -Recurse | Rename-Item -NewName {$_.name -replace ' ','-' } -whatifthis works but will also touch files in the root of the customers folder, which i would prefer not to happen.Thanks in advance!

Viewing all articles
Browse latest Browse all 467

Trending Articles