Skip to content

Instantly share code, notes, and snippets.

@forsythetony
Created June 5, 2014 21:00
Show Gist options
  • Save forsythetony/6fa0a1ae84a4eec3ecc0 to your computer and use it in GitHub Desktop.
Save forsythetony/6fa0a1ae84a4eec3ecc0 to your computer and use it in GitHub Desktop.
#
# Function definitions
#
function deleteAVIFilesInPath($path)
{
if((Test-Path $path) -ne $true)
{
$errMessage = "The path given was not valid"
return $errMessage
}
Write-Host "Things"
Write-Host ("The path is " + $path)
Get-ChildItem -Path $path -Recurse | Where-Object { $_.Extension -eq ".avi"} | ForEach-Object {
Write-Host ("Deleting file " + $_.Name)
Remove-Item $_.FullName
}
return $null
}
#
# Main program
#
$path = Read-Host "Enter the path to the folder containing subfolder 'kinectData'"
$confirmMessage = ("All .avi files in the folder " + $path + " will be deleted.")
Write-Host $confirmMessage
$userOption = Read-Host "Enter any key to continue or Ctrl-C to exit"
$ret = deleteAVIFilesInPath $path
if ($ret -ne $null)
{
Write-Host $ret
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment