ftp archive , name , and upload

Hi! Ive tried to make this in automator- but i didnt find how to make a variable from PART of filename. Automator cant do this - anyway i didnt fonud how to do that.

there is:
some files (from 5 to 20) on my mac , and ftp server.
there is a folder , and files on my mac . They have names like aaaa-var-aaa.pdf all the files have same “var”
var- it is unique number, it change every day.
there is no second number , but it is = (var + 150)

task is
to upload to ftp server to specified directory ZIP= archive , with name like “name , var , var2 , todays day month and year.pdf”

ftp server got its password and login.
zip archive wouldn’t havepassword

maybe i can do this in automator or in applecript? can u write me this script if u can plz?


I honestly don’t understand, what exactly you want to do.

Creating a timestamp (format yyyymmdd) is easy with

set TimeStamp to do shell script "date -n +%Y%m%d"

here is a simple routine to upload a chosen file to a ftp server:

property ftpserver : "[url=ftp://ftp.myserver.com]ftp.myserver.com[/url]" --ftp server 
property ftppath : "/pub/" --the directory on the server (for the root directory, leave this empty)
property server_username : "myusername" --server_username (if you want to get asked for it everytime, leave this empty)
property server_password : "¢¢¢¢¢¢" --server_password (if you want to get asked for it everytime, leave this empty)

set servername to ftpserver & ftppath
set itemPath to quoted form of POSIX path of (choose file)
try --where the file is
	do shell script "curl " & servername & " -u " & server_username & ":" & server_password & " -T " & itemPath
on error e
	display dialog e -- or log into some log file  
end try