Welcome to the combo post of How to Delete Every Other File in a Folder and How to Make a GUI. For lack of a better name, I’m calling it a targeted file deleter program. It can automate the process of deleting every other file if the file name ends in sequential numbers.
For those who couldn’t care less about how it functions, just follow these two steps.
STEP 1: Fire up a new AutoHotkey* file.
*Download it here if you haven’t already.
STEP 2: Paste this text inside. And run the file.
Gui, -Caption
Gui, Color, Black
Gui, Font, cWhite s12
Gui, Add, Text, , The Targeted File Deleter
Gui, Add, Text, , Note: File names must be sequential (for ex. IMG_1.jpg) and cannot have leading zeros (IMG_001.jpg).
Gui, Add, Text, , What is the folder you want to delete files from? (Ex. C:\Users\Desktop\)
Gui, Add, Edit, vFilePath w500 cblack
Gui, Add, Text, , How does the file name start? (Do not include numbers)
Gui, Add, Edit, vFileNameStart w500 cblack
Gui, Add, Text, , What number does the file name start at?
Gui, Add, Edit, vFileNumberStart w500 cblack
Gui, Add, Text, , By what increment do you want to delete files?
Gui, Add, Edit, vIncrement w500 cblack
Gui, Add, Text, , What is the file extension? (Ex. .jpg, .pdf, .doc)
Gui, Add, Edit, vExtension w500 cblack
Gui, Add, Text, , How many files have you got total?
Gui, Add, Edit, vLoopCount w500 cblack
Gui, Add, Button, x570 y370, OK
Gui, Add, Button, x570 y410, Cancel
Gui, Show, , The Mass File Deleter
returnButtonOK:
Gui, Submit
Loop
{
if A_Index < %LoopCount%
FileDelete, %FilePath%%FileNameStart%%FileNumberStart%%Extension%
FileNumberStart+=%Increment%
}
returnButtonCancel:
ExitApp
Continue reading “AHK Update: Targeted File Deleter Program”