Copy Filename, Delete File, Create File w/ Same Name -AppleScript

Below is a script that I assembled from various sources. It works. I made it into an App and placed it into the Dock, so I just select the file and then click on the app in the dock.

OBJECTIVE:
To replace a file that occupies disk space with a file of the exact same name that does not occupy (significant) disk space.

CURRENT PROBLEM:
It’s one-click, one file at a time.

CURRENT REQUEST:
Does anyone know how to make this script perform this operation several thousand times within a given folder?


-- Gets current folder and sets it as a variable "currentDir"
tell application "Finder"
	if exists Finder window 1 then
		set currentDir to target of Finder window 1 as alias
	else
		set currentDir to desktop as alias
	end if
end tell
log POSIX path of currentDir


-- Copies selected file's name to clipboard
try
	tell application "Finder" to set theName to name of item 1 of (get selection)
	set the clipboard to theName
end try


-- Moves selected file to Trash 
tell application "Finder"
	move (get selection) to trash
end tell


-- Creates a new file with the copied name
tell application "Finder" to make new file at currentDir with properties {name:theName, creator type:"8BIM", comment:"I am a blank file! Wow, pointless!"}

Yes, I know this sounds stupid, but I need all the files to be present for some other operation to work, but I don’t want to use up so many KB per file.

This will prompt you to select a folder, then it will replace all the files within the selected folder with blank zero kb files. I added a confirmation dialog just in case you accidentally select a folder you didn’t mean to.


-- Gets current folder and sets it as a variable "currentDir"
tell application "Finder"

	set currentDir to choose folder with prompt "Choose the directory with the files to replace"
	log POSIX path of currentDir
	
	-- Displaying a warning dialog to the user
	set warningDialog to display dialog "REALLY DELETE FILES?" & return & "Are you sure you want to replace all the files in directory " & (POSIX path of currentDir) & " with blank zero KB files?" with icon stop
	
	-- Copies selected file's name to clipboard
	if button returned of warningDialog contains "OK" then
		try
			set my_files to every file of currentDir as alias list
			repeat with my_file in my_files
				set theName to name of my_file
				set the clipboard to theName
				
				-- Deletes the old file
				move my_file to trash
				
				-- Creates a new file with the copied name
				make new file at currentDir with properties {name:theName, creator type:"8BIM", comment:"I am a blank file! Wow, pointless!"}
			end repeat
		end try
	end if
	
end tell


Wow, that’s fantastic! Thank you, pcLoadLetter!