Please help in converting filenames errors

Thanks a lot for your help
I am trying to set the creation date as the new file name in series of files within a folder
I try to modify various scripts I found for my purpose


set source_folder to choose folder with prompt "Please select directory."
set destination to choose folder with prompt "Please select directory."

tell application "Finder"
	set file_list to every file of folder source_folder
end tell
tell application "Finder"
	launch
	try
		duplicate source_folder to destination
	on error errorMsg number errorNum
		display dialog "Error (" & errorNum & "):" & return & return & errorMsg buttons "Cancel" default button 1 with icon caution
	end try
	
	repeat with aFile in file_list
		set file_info to info for (aFile as alias)
		set file_creation_date to creation date of file_info
		set tPath to quoted form of (POSIX path of aFile)
		set tName to name of (info for aFile)
		set MD to do shell script "mdls -name kMDItemContentCreationDate " & aFile
		set TID to AppleScript's text item delimiters
		set AppleScript's text item delimiters to "= ("
		set tDates to text item 1 of MD
		set AppleScript's text item delimiters to ")"
		set tDates to (text item 1 of tDates) as text
		set AppleScript's text item delimiters to TID
		set dateInfo to text 30 thru -1 of tDates
		set newFilename to dateInfo
		try
			tell application "Finder" to set name of aFile to newFilename
		end try
		
	end repeat
end tell

the error I get is:

Can’t make «class docf» “10 - TXT.doc” of «class cfol» “result” of «class cfol» “newfolder” of «class cfol» “ecco” of «class cfol» “my folder” of «class cfol» “Documents” of «class cfol» “ZZZ” of «class cfol» “Users” of «class sdsk» of application “Finder” into the expected type.

Hi,

try this


set source_folder to choose folder with prompt "Please select directory."
set destination to choose folder with prompt "Please select directory."
tell application "Finder"
	set duplicatedFolder to duplicate source_folder to destination
	set allItems to items of duplicatedFolder
	repeat with anItem in allItems
		tell contents of anItem
			tell (get creation date of it) to set newDate to its short date string & "_" & its hours & its minutes & its seconds
			set its name to newDate
		end tell
	end repeat
end tell


Thanks