Skip to content

Commit

Permalink
Added Retry Code to Delete (SanitizeFiles)
Browse files Browse the repository at this point in the history
Added /Y arguments to copy and move
  • Loading branch information
matonb committed Apr 4, 2013
1 parent 98ddfa9 commit 93106f2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
23 changes: 20 additions & 3 deletions AppCodeImportExport.bas
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,27 @@ Dim objName As String
OutFile.Close
Infile.Close
'
' Delete the old file
Kill Path & objName & ".txt"
' Delete the old files
Dim retryCount As Integer
retryCount = 0
On Error GoTo RetryDelete
RetryDelete:
If retryCount < 3 Then
retryCount = retryCount + 1
Kill Path & objName & ".txt"
Else
If MsgBox("Error Deleting Files" & vbCrLf & _
"Try again ?", vbYesNo, "Warning") = vbYes Then
retryCount = 0
GoTo RetryDelete
Else
GoTo ResumeDelete
End If
End If
ResumeDelete:
On Error GoTo 0
'
' Rename Sanitized file
' Rename Sanitized files
Name Path & objName & ".sanitize" As Path & objName & ".txt"

fileName = Dir()
Expand Down
2 changes: 1 addition & 1 deletion scripts/ucs2-to-utf8.bat
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ echo %sourcePath%modules
cd %sourcePath%modules >NUL 2>&1
:: Exported text from Access for 'modules' is not UCS-2; don't convert.
if exist *.data (
forfiles /m *.data /c "cmd /c move @file @fname.txt" >NUL 2>&1
forfiles /m *.data /c "cmd /c move /Y @file @fname.txt" >NUL 2>&1
)

echo Done.
Expand Down
2 changes: 1 addition & 1 deletion scripts/utf8-to-ucs2.bat
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ cd %sourcePath%modules >NUL 2>&1
:: Exported text from Access for 'modules' is not UCS-2; don't convert.
del *.data >NUL 2>&1
if exist *.txt (
forfiles /m *.txt /c "cmd /c copy @file @fname.data" >NUL 2>&1
forfiles /m *.txt /c "cmd /c copy /Y @file @fname.data" >NUL 2>&1
)

echo Done.
Expand Down

0 comments on commit 93106f2

Please sign in to comment.