Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

remove-item wildcard

$
0
0

I've looked at the help on remove-item but did not see what I needed.    I need to delete all files that begin with AT and have a .job extension.   at*.job  I have this script but it does not delete the files.  what is the syntax to do this?  

$Path="c:\windows\tasks\at*.job"
$Log="\\Server\d$\tools\logging"
$name= (Get-WmiObject-class win32_ComputerSystem -Property*).name
If (Test-Path$Path) {
Remove-Item"$path\at*.job"-Force-Recurse;
$name | Out-File"$log\$name"
}


Viewing all articles
Browse latest Browse all 6937

Trending Articles