Thursday 22 August 2013

rename the file with Sysdate in Unix

########################################
#                  Rename the file with sysdate               #
########################################

 
 for file in ${FILE_NAME}*.${FILE_EXT}
 do
 newfile=$(date "+%d%b%Y_$file" -d "$(stat -c "%y" $file)")
 mv "$file" "$newfile" 

No comments:

Post a Comment