Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function DeleteSourceFiles($srcPath) {
- # Announce delete
- OutputToHostAndLog ("Files will be removed from "+$srcPath+"...")
- OutputToHostAndLog "Removing files..."
- # Deletes all file items (i.e. all except folders) in source folder
- $filesToDelete=Get-ChildItem $srcPath | Where-Object {$_ -is [IO.FileInfo]}
- ForEach($item in $filesToDelete) {
- Remove-Item $srcPath$item -force
- # Verify deletions
- if(Test-Path($srcPath+""+$item)) {
- OutputToHostAndLog ("Delete failed: "+$item.Name)
- $fail++
- }
- else {
- OutputToHostAndLog ($item.Name+" deleted successfully...")
- }
- }
- }
- function DeleteSourceFiles($srcPath) {
- # Announce delete
- OutputToHostAndLog ("Files will be removed from "+$srcPath+"...")
- OutputToHostAndLog "Removing files..."
- OutputToHostAndLog $gap
- # Delete all file items (i.e. all except folders) in source folder
- $filesToDelete=Get-ChildItem $srcPath | Where-Object {$_ -is [IO.FileInfo]} | ForEach {
- Remove-Item $_.FullName -Force
- # Verify deletions
- if(Test-Path($srcPath+""+$_)) {
- OutputToHostAndLog ("Delete failed: "+$_.Name)
- $fail++
- }
- else {
- OutputToHostAndLog ($_.Name+" deleted successfully...")
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement