Borje Posted January 5, 2012 Posted January 5, 2012 (edited) Hi everybody good programmers I have some problem to have the example 1 to work but in the example 2 all works my question is what is wrong in example 1 in line Filedelete ? It deletes not the 0 zize files in example 1 Can anybody tell me why this not works in the example 1 and tell what i have done for Example #1 ; #Include $var1 = RegRead("HKEY_CURRENT_USER\Software\IncrediMail\Identities", "") $file = _filelisttoarray(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\"&$var1, "*",1) for $i=1 to UBound($file)-1 $file_size = FileGetSize(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\"&$var1 & $file[$i]) if $file_size = 0 Then FileDelete(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\"& $var1 & $file[$i]) endif next --------------------------------------------------------------------------- Example #2 ; $file = _filelisttoarray(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\{F9F78C8F-C4D1-4D35-9A40-39333FA992F0}\", "*",1) ;for $i=1 to UBound($file)-1 ;$file_size = FileGetSize(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\{F9F78C8F-C4D1-4D35-9A40-39333FA992F0}\" & $file[$i]) ;if $file_size = 0 Then ;FileDelete(@UserProfileDir & "\Lokala Inställningar\Application Data\IM\Identities\{F9F78C8F-C4D1-4D35-9A40-39333FA992F0}\" & $file[$i]) ;endif ;next Edited January 5, 2012 by Borje
kaotkbliss Posted January 5, 2012 Posted January 5, 2012 (edited) hmmm, small sample worked for me maybe try adding MsgBox(0,"",$file_size) after the FileGetSize just to be sure that the file is actually 0 bytes. *edit* Because of the location of the folder you wish to delete files from, you may need to use admin rights Edited January 5, 2012 by kaotkbliss 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy!
jchd Posted January 5, 2012 Posted January 5, 2012 @OP, No error checking in your code leaves you (and us) blind. Maybe the value is not Default, or something else, like the missing 64 suffix if you run x64, or ??? _ArrayDisplay what you get would also help. BTW, use Code markup to wrap your source. If the file string is bad, the value is likely to remain at 0, so this doesn't show much. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)
Borje Posted January 5, 2012 Author Posted January 5, 2012 Thanks kaotkbliss I have already check this but now I have found the problem I missed backward in array please look $var2... $var1 = RegRead("HKEY_CURRENT_USERSoftwareIncrediMailIdentities","") $var2 = $var1 &"" $file = _filelisttoarray(@UserProfileDir & "Lokala InställningarApplication DataIMIdentities"&$var2, "*",1) for $i=1 to UBound($file)-1 $file_size = FileGetSize(@UserProfileDir & "Lokala InställningarApplication DataIMIdentities"&$var2 & $file[$i]) if $file_size = 0 Then FileDelete(@UserProfileDir & "Lokala InställningarApplication DataIMIdentities"& $var2 & $file[$i]) endif next This code works... Thanks all
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now