Need help with automator

I have an enormous number of files on Macs that I need to transfer to a Windows system. I would like to run automator and have it ask for a folder and then rename the files by removing characters that are incompatible with Windows and shorten the file names to 30 characters while retaining the extension (if there is one). I would like the process to also do the same to any subfolders found in the originally selected folder.
I am a noob to Automator, AppleScript, and Bash. I have been trying different things that I have found and trying to piece them together but am not having the greatest luck.
This is what I have so far and I need help modifying it to work for me.
Automator asks you to pick a folder
set value of variable

I have this Bash script that removes incompatible Windows characters
for f in “$1”/*; do
dir=$(dirname “$f”)
file=$(basename “$f”)
mv “$f” “${dir}/${file//[^0-9A-Za-z._-]}”

Then this AppleScript that is supposed to shorten the filename and retain extension. The problem is I have to select the folder again. I want it to use the same folder as previously selected.

 this_folder to choose folder with prompt "Choose a folder to fix filenames:"
tell application "Finder"
	set all_files to every file in folder this_folder
	repeat with a_file in all_files
		set f_name to a_file's name
		set f_ext to a_file's name extension
		set p_off to offset of f_ext in f_name
		if p_off is greater than 30 then
			set f_name to (characters 1 thru 30 of f_name & "." & f_ext) as string
			my CheckName(f_name, this_folder, f_ext, a_file)
		end if
	end repeat
end tell

on CheckName(fn, fld, ex, fl)
	set next_let to 97
	tell application "Finder"
		set all_names to the name of every file in folder fld
		if all_names contains fn then
			repeat until all_names does not contain fn
				set fn to (characters 1 thru 30 of fn & (ASCII character next_let) & "." & ex) as string
				set next_let to next_let + 1
			end repeat
		end if
		set name of fl to fn
	end tell
end CheckName

How can I modify the Applescript to use the same folder as selected in the beginning and How do I set this up to do subfolders as well?
Please help me.

Browser: Safari 537.36
Operating System: Mac OS X (10.10)