8,330 questions
Remove the -Whatif to actually create the file.
Get-ChildItem -Path "E:\Folders\New folder" -Directory -Recurse | ForEach-Object {New-Item -Path $_.FullName -Name "testfile1.txt" -ItemType File -WhatIf }
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Let's say there is a folder "New Folder" its path is <"E:\Folders\New folder">
Now there are Sub folders "A" , "B" , "C" , "D" , "E" inside "New Folder". Now What i want is to create a .txt file (Any name) in all the sub folders (ie; inside A B C D E).
I would like to do it with PowerShell but would also don't mind using some software.
Remove the -Whatif to actually create the file.
Get-ChildItem -Path "E:\Folders\New folder" -Directory -Recurse | ForEach-Object {New-Item -Path $_.FullName -Name "testfile1.txt" -ItemType File -WhatIf }