Here is a little utility i made to clean remaining torrent files from utorrent
it send the files to recycle bin so its kinda safe ;)
'uTorrent Cleaner 1.0
'by KrYpT 2009
'Latest Headers by Sapero needed
$MAIN
$ifndef WIN32
$define WIN32
$endif
$ifdef WIN32
'speed up compile time a little
$define WIN32_LEAN_AND_MEAN
$endif
$INCLUDE "windowssdk.inc"
$INCLUDE "commctrl.inc"
$INCLUDE "shlobj.inc"
'/////////////////////////////////////////////////////////////////
'Controls Ids
ENUM Controls
Listview = 200
Clean
CheckAll
Invert
ENDENUM
'/////////////////////////////////////////////////////////////////
DIALOG main
CREATEDIALOG main,0,0,561,343,0x80CA0080,0,"uTorrent Cleaner 1.0 by Krypt",&HandlerMain
CONTROL main,@LISTVIEW,"",14,14,533,264,0x50810125,Listview
CONTROL main,@SYSBUTTON,"Clean",466,292,80,35,0x50010000,Clean
CONTROL main,@SYSBUTTON,"Check Them All",14,292,100,35,0x50010000,CheckAll
CONTROL main,@SYSBUTTON,"Invert Selection",120,292,100,35,0x50010000,Invert
'path to appdata roaming
STRING path = GetFolderLocation(main,CSIDL_APPDATA)
path = path + "\\uTorrent"
DOMODAL main
END
'/////////////////////////////////////////////////////////////////
'Dialog handler
SUB HandlerMain
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW main
INT MyIcone = LOADIMAGE("utorrent",@IMGICON)
'Set the caption icon
SETICON main,MyIcone
/* Initialize any controls here */
'set listview columns text and size
CONTROLCMD main,Listview,@LVINSERTCOLUMN,0,"Filename"
CONTROLCMD main,Listview,@LVSETCOLWIDTH,0,529
'Send extended listview style message
SENDMESSAGE(main,LVM_SETEXTENDEDLISTVIEWSTYLE,0,LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES|LVS_EX_ONECLICKACTIVATE,Listview)
'scan for torrent files
Scan()
CASE @IDCLOSEWINDOW
CLOSEDIALOG main,@IDOK
CASE @IDCONTROL
SELECT @CONTROLID
CASE Listview
/* respond to control notifications here */
CASE Clean
IF @NOTIFYCODE = 0
/*button clicked*/
Clean()
ENDIF
CASE CheckALL
IF @NOTIFYCODE = 0
/*button clicked*/
SetCheck(main,Listview, -1, 1)
ENDIF
CASE Invert
IF @NOTIFYCODE = 0
/*button clicked*/
InvertSelection()
ENDIF
ENDSELECT
ENDSELECT
RETURN
ENDSUB
'/////////////////////////////////////////////////////////////////
'Scan utorrent temp folder for torrents
SUB Scan()
CONTROLCMD main, ListView, @LVDELETEALL
INT dir = FINDOPEN(path+"\\*.torrent")
string filename
int count = 0
IF(dir)
DO
filename = FINDNEXT(dir)
if filename <> ""
CONTROLCMD main, ListView, @LVINSERTITEM, 0, filename
count++
endif
wait 1
UNTIL filename = ""
FINDCLOSE dir
ENDIF
SETCAPTION(main,"uTorrent Cleaner 1.0 - " + str$(count) + " Torrent Files Found")
return
ENDSUB
'Clean torrents
SUB Clean()
int count = CONTROLCMD( main, ListView, @LVGETCOUNT)
int item
int trouble = 0
int filedeleted = 0
For item = 0 To (count-1)
'check if the item is checked
If GetCheckState(main,Listview,Item)
string filename
CONTROLCMD( main, ListView, @LVGETTEXT, item, 0, filename)
'send file to recycle bin
int InBin = SendToRecycleBin(path + "\\" + filename)
if InBin <> 0
trouble = 1
else
filedeleted++
endif
endif
Next item
Scan()
if filedeleted <> 0
MESSAGEBOX main,str$(filedeleted) + " Files sent to Recycle Bin","Cleaning Complete!!", @MB_ICONINFORMATION
ELSE
MESSAGEBOX main,"No files selected","Warning !!"
endif
if trouble = 1
MESSAGEBOX main,"Some files has'nt been deleted","Error occur"
endif
RETURN
ENDSUB
'Set checkbox state (1 = checked, 0 = Unchecked, -1 at index for all item)
'return true is successfull or false otherwise
Sub SetCheck(window win, int id, int lItemIndex, int bState),int
LVITEM lv
lv.mask = LVIF_STATE
If bState Then bState = 0x2000 Else bState = 0x1000
lv.state=bState
lv.stateMask = LVIS_STATEIMAGEMASK
return SendMessage(win,LVM_SETITEMSTATE,lItemIndex,lv,id)
EndSub
'invert listview checkbox selection
Sub InvertSelection()
For t = 0 To ControlCMD(main,Listview,@LVGETCOUNT)-1
If GetCheckState(main,Listview,t)
SetCheck(main,Listview, t, 0)
Else
SetCheck(main,Listview, t, 1)
EndIf
Next t
Return
EndSub
'Get the item checkbox state
'return true if checked false if not
SUB GetCheckState(window win, int Id, int Item),int
return SENDMESSAGE(win,LVM_GETITEMSTATE,item,LVIS_STATEIMAGEMASK,id)/4096-1
ENDSUB
'Get special folder location
SUB GetFolderLocation(dialog win,INT nFolder),STRING
STRING path = ""
POINTER pidl
POINTER ppidl
ppidl = &pidl
SHGetSpecialFolderLocation(win.hwnd,nFolder,ppidl)
SHGetPathFromIDList(pidl,path)
CoTaskMemFree(pidl)
RETURN path
ENDSUB
'Move a File To Recycle Bin
'return 0 if successfull or none zero error code if not
SUB SendToRecycleBin(string path),int
SHFILEOPSTRUCT FileOp
FileOp.wFunc = FO_DELETE
FileOp.pFrom = path
FileOp.pTo = ""
FileOp.fFlags = FOF_NOCONFIRMATION|FOF_ALLOWUNDO
'FileOp.lpszProgressTitle = "Sending " + path + " to the Recycle Bin"
return SHFileOperation(FileOp)
ENDSUB