Help with shell script "date +%m_%d_%y"

I’m using a shell script to attach the date to a file name before moving it.
I’d also like the string to include the time. What do I add to [shell script “date +%m_%d_%y”] to get the time added into the string as well?

For reference, here’s the script I’m using (as originally posted by sitcom in another old thread from 2005):


--on adding folder items to ThisFolder after receiving added_items

set ThisFolder to choose folder --example of attached folder
set DestinationFolder to choose folder --you can hardwire this path if the destination is constant

tell application "Finder" to set added_items to every file of ThisFolder

tell application "Finder" to set added_items_FilenameList to name of every file of added_items as list

tell application "Finder" to set ExistingFilenames to name of every file of DestinationFolder as list


repeat with ThisFile in added_items
	set ThisFilesName to name of ThisFile as string
	if ThisFilesName is in ExistingFilenames then
		
		set AppleScript's text item delimiters to "."
		set BaseFilename to text item 1 of ThisFilesName
		set FileExt to name extension of ThisFile
		set AppleScript's text item delimiters to ""
		
		set DateStamp to do shell script "date +%m_%d_%y" --You may want to remove '_%y' 
		
		set name of ThisFile to BaseFilename & "_" & DateStamp & "." & FileExt
		
	end if
end repeat

tell application "Finder" to set Renamed_added_items to every file of ThisFolder
tell application "Finder" to move Renamed_added_items to DestinationFolder


Cheers!
Michael

Hi,

From the date man page

. %H is replaced by the hour (24-hour clock) as a decimal number (00-23). . %M is replaced by the minute as a decimal number (00-59). . %S is replaced by the second as a decimal number (00-60). .


set DateStamp to do shell script "date +%m_%d_%y_%H_%M_%S"

That did it, thanks!!
Michael