Can anyone show me a script to remove a directory and its backup? I'm very new to scripting.
I ran the script below which created a directory called "Data" with 3 text files called "one", "two", and "three" and a "backup."
$location = "C:Data"
if ((Test-Path $location) -ne $True)
{ New-Item $location -type directory }
$textfiles = "one.txt", "two.txt", "three.txt"
foreach($file in $textfiles)
{
if((Test-Path "$location$file") -ne $True) { new-item $location$file -type file }
}
cp C:data C:backup
cp C:data* C:backup