I am developing script to scan files in the folder and list all the empty and corrupted files in to a csv.
Trying to find a way for AHK to return true or false for a function corruptedFile()
Trying to find a way for AHK to return true or false for a function corruptedFile()
Code: Select all
MsgBox % func("C:\Dir\SubDir\*.*")
func(path) {
Loop, Files,% path, R
{ if (A_LoopFileSize=0)
fIndex .= A_LoopFilePath ";"
}
FileAppend, % RTrim(fIndex,";"), corruptFiles.csv
Return "Done!"
}
Actually I want to list any corrupted file. Is there a common indicator to identify corrupted files programmatically?Q: what's your indicator that a file is corrupt? Just it's 0-byte filesize??
I'd assume that AHK’s FileOpen()-function (and its return value output/A_LastError) can do the job?When considering media files, we get in to know that the file is corrupted only after opening the file. Is there a common way to capture the corrupted files without opening it?