AHK Update: Targeted File Deleter Program

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
return

ButtonOK:
Gui, Submit
Loop
{
if A_Index < %LoopCount%
FileDelete, %FilePath%%FileNameStart%%FileNumberStart%%Extension%
FileNumberStart+=%Increment%
}
return

ButtonCancel:
ExitApp

If executed properly, it should look like this:

FilesToDeleteGUIAfter clicking OK, the files should disappear:

ProgramAnimated

 

For the Masochists: How It Works

Targeted File Deleter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: