ftp - put date/time in filename

In a ftp script, I'm trying to put a file and add the date / time to the end of the filename.

cmd from crontab:
   ftp -v -i  -n < /users/and1/xxx_export_ott_inv_dat.bat

inside /users/and1/xxx_export_ott_inv_dat.bat:
   put /users/and1/xxx_export/OTT_INV.DAT OTT_INV.`date '+%Y%m%d'`

but the file that gets created is OTT_INV.`date

MTL999Asked:
Who is Participating?
 
medveddConnect With a Mentor Commented:
You can't use reverse quotes inside ftp - it works only for shell.
You should generate file name with timestamp in shell and then pass it to ftp:

echo put /users/and1/xxx_export/OTT_INV.DAT OTT_INV.`date '+%Y%m%d'` >filename.bat
ftp -v -i  -n < filename.bat



0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.