hot202 Posted August 24, 2009 Posted August 24, 2009 Ok guys i wanted to know how i can delete all .doc out of a folder. I use FileSelectFolder and IniWrite to save the location of the folder. so i will use iniread then i need to know what to add to delete all same file types.
Andreik Posted August 24, 2009 Posted August 24, 2009 Check FileDelete() function. Wildcards are supported. >_
hot202 Posted August 24, 2009 Author Posted August 24, 2009 thanks heaps also how would i be able to add checkboxes each 1 deletes a diff filetype and if its checked i click delete button and it deletes the files but dosnt deleate the ones that aint ticked? dose that make sence?
Andreik Posted August 24, 2009 Posted August 24, 2009 Hope I understand corect: #include <GuiListView.au3> #include <File.au3> $DIR = FileSelectFolder("Select","") $EXT = InputBox("Extension","Please type files extension.","*.txt") GetDelFiles($DIR,$EXT) Func GetDelFiles($DIR,$EXT) Local $FILE = _FileListToArray($DIR,$EXT,1) Local $GUI = GUICreate("Delete Files",300,300,-1,-1,0x16C80000,0x00000181) Local $LIST = GUICtrlCreateListView("File",5,5,290,250,0x00200000,BitOR(0x00000004,0x00000200)) _GUICtrlListView_SetColumnWidth($LIST,0,280) For $INDEX = 1 To $FILE[0] $ITEM = GUICtrlCreateListViewItem($FILE[$INDEX],$LIST) Next $DEL = GUICtrlCreateButton("Delete",100,270,100,20) GUISetState(@SW_SHOW,$GUI) While True $MSG = GUIGetMsg() If $MSG = -3 Then Exit ElseIf $MSG = $DEL Then For $INDEX = 1 To $FILE[0] If _GUICtrlListView_GetItemChecked($LIST,$INDEX-1) Then FileDelete($DIR & "\" & $FILE[$INDEX]) EndIf Next GUIDelete($GUI) MsgBox(0x40,"Info","Selected file(s) was deleted.") ExitLoop EndIf Sleep(15) WEnd EndFunc
hot202 Posted August 24, 2009 Author Posted August 24, 2009 thanks but what i mean is i will have check boxes 4 the file types that i wanted deleted. if a checkbox it ticked when i click the delete button it will only delete the file type i set that checkbox to be soit wont delete the other file types unless the checkboxes r ticked.
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