Unix/Linux Go Back    

Adding date and time to file name

Shell Programming and Scripting

Kindly Note - This is a Single User Post by Forum Member cc_at_work Regarding:
Adding date and time to file name.
Please Follow The Primary Link Above to View the Full Discussion.

Old Unix and Linux 11-15-2010   -   Original Discussion by cc_at_work
cc_at_work cc_at_work is offline
Registered User
Join Date: Nov 2010
Last Activity: 12 January 2011, 8:20 PM EST
Posts: 4
Thanks: 2
Thanked 0 Times in 0 Posts
Originally Posted by frans View Post
Why store it? (but it's preferable to store the date string to avoid calls to date in the iteration.

D=$(date +%d-%m-%Y)
for F in *.*
	mv $F ${F%.*}-$D.${F##*.}")

how about for files without any extension.. like lets say just "debug" and not "debug.txt" ? any idea?