Hi,
I have written a script to rename a file, but I can not add the current date (in YYYYMMDD-HHMM format)
can you please look at this cript, and help?
thanks,
#!/usr/local/bin/tcsh -f
set server = "$1"
set user = "$2"
if (-f $server) then
\mv $server $server.Saar.[HERE_I_WANT_DATE]
endif
system
February 13, 2002, 11:42am
2
Not completely sure if this will work with tcsh, but you can give it a shot. My OS is Dynix/ptx.
D=`date +%Y%m%d-%H%M`
echo $D
Sorry...I didn't mention that this would just get you the date, and that you would have to incorporate it into your command line.
Cameron
February 13, 2002, 8:51pm
3
Try ...
\mv $server $server.Saar.`date '+%Y%m%d-%H%M'`
, Thanks.
theKid: your answer didn't work, but thanks for trying.
Cameron, yours did, thanks.
Cameron
February 14, 2002, 8:42am
5
sierra_aar,
thekids was logically correct but in the syntax used forgot the single quote's(') around the date para's.
An oversight that anyone could make.
Otherwise, glad I could help out.