Get Timestamp in mk file - makefile

I could like to append a timestamp to the build property value in Android.mk file.Is there a way to get the current timestamp (format "YYMMDD") in a Android make file?

I don't know if there is something specific with an Android make file, but the following works in GNUmake:
DATE := $(shell date --utc +%Y%m%d)
$(info Current UTC date is $(DATE))

Related

Need help in Bashscript for monthwise

I've a directory name date which contains files from jan to dec, for example file name jan.sh, feb.sh until dec.sh. Now I want to make a bash script that will copy each file to xyz directory on the first day of each month. On jan it will copy jan.sh and on feb.sh and so on until the month of dec.
CURRENT_MONTH=$(date "+%b") # e.g. The display depends on locale (LANG environment variable)
cp "${CURRENT_MONTH}.sh" destination_dir # Adjust the formatting of source name according to the display of date

how to download today's files based on filename using sftp in unix

In my "Remote_InputFolder" directory i had the below list of files.
physicalDevice_20130722000000_incremental.xml
userProfile_20130722000000_full.xml
physicalDevice_20130723000000_incremental.xml
userProfile_20130723000000_full.xml
physicalDevice_20130724000000_incremental.xml
userProfile_20130724000000_full.xml
i want to download files having today's date in their filename. i used the below sftp code, but it's not working.
sftp ${SFTPUserName}#${SFTPHostName} <<EOF .... get *{date +%Y%m%d}*.xml ..EOF
Any help please.
It should be:
$(date +%Y%m%d)
instead of:
{date +%Y%m%d}

Having Issue with file name appended with date -shell scripting

I tried to append the current day and time to the existing file name in shell scripting and I found my command is not working as expected.
For example, if my file name is f1.log and I nees to append it along with current time. This appended version must be used for further processing of the file.
I tried with the following script but getting an error
now=$(date +"%m-%d-%Y/%T")
echo hi >>time.log
mv "time.log" "time.$now.log" (error here : file or directory not found)
echo hello >> time.log$now (have to continue processing with new file)
You cannot have a / character in a filename. The mv command is looking for a directory named with the minute, day, and year of the output of date and trying to create a file named by the time. Just change your format to not include / in the filename.
The problem is with shell's interpertation of / in your date +"%m-%d-%Y/%T".
Change it to a - instead (or something else, as long as it's not / or another meta character that will make the files difficult to work with in the future)

How to update a program with a daily changing file name?

I have a program that reads in a file and does some parsing to it. The file is generated by another program every night. Due to the ICD the date is part of the file name.
The file name changes every night due to the date change so I am not sure how to have my program change the fileIn name to accommodate this.
If the current fileIn is:
in20120103out.dat
Tomorrow's fileIn is:
in20120104out.dat
filename = Time.now.strftime("in%Y%m%dout.dat")
or
require 'date'
filename = Date.today.strftime("in%Y%m%dout.dat")
strftime means string format for time. The %-parameters are placeholder for Year (Y), month (m), day (d). (There are more placeholders, e.g. year without century...)
You can use the strftime() method to generate the date portion of the filename:
t = Time.­now
filename = "in#{t.strftime('%Y%m%d')}out.dat"
And then use the filename variable to open the file as normal.

Compress a file with todays date

I want to compress a file with name ASCOnnect200_V5.0.0.0_09_Dec_11.zip. I it possible with winrar/rar?
The file name ASCOnnect200_V5.0.0.0_ will be always constant and the date part will be in the format dd-mmm-yy.
In cmd:
rar.exe a -ag+YYYYMMDD arc {FolderName}
The answer is in this forum :)

Resources