Dears,
I want to create script to rename multiple file names from unix date to date for example
filename_1421907815_department.txt
rename to
filename_2015_01_22_08_23_department.txt
LOGFILES="schedule_download.log schedule_download_AccountancyServices.log schedule_download_FinancialControl.log schedule_download_IncomeCollection.log schedule_download_banner.log manual_download.log manual_download_AccountancyServices.log manual_download_bacs_cheques.log manual_download_FinancialControl.log manual_download_IncomeCollection.log manual_download_banner.log manual_download_Procurement.log manual_upload.log" LOGDATE=`date +%Y%m%d` for file in $LOGFILES do cp $file $file.$LOGDATE done ## Remove log files older than 30 days for file1 in ${LOGFILES}.* do find $file1 -mtime +30 -exec rm -v \; done
#!/bin/bash rsync.exe -rltDvP --exclude "System Volume Information" --exclude "RECYCLER" --exclude=\$RECYCLE.BIN --delete "/cygdrive/c/users/<USERNAME> /desktop/mvi_1840.mov" "/cygdrive/c/users/<USERNAME>/desktop/test/"
#!/bin/ksh filename="/apps/log/file.txt" if [ -f "${filename}" ] then createTime=`ls -lad "${filename}" | awk '{print $8}'` echo "$createTime" currentTime=`date '+%M'` echo "$currentTime" DIFF=$(( $currentTime - $createTime )) echo "$DIFF" else exit 1 fi