mkone Posted September 30, 2015 Posted September 30, 2015 I can use this script to delete 0 kb files from a specified path. get-childItem "PathToFiles" | where {$_.length -eq 0} | remove-Item How can i run this on multiple PC's in a text file (list.txt)? The contents of text file would be: pc1 pc2 or \\PC1\c$\files\ \\PC2\c$\files\
halbaradkenafin Posted September 30, 2015 Posted September 30, 2015 If you have the list in the second format then you should be able to do something like this: Get-content -path C:\file.txt -pipelinevariable folder| foreach-object { Get-ChildItem $folder | where { $_.length -eq 0} | remove-item -confirm $false}
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now