PDA

View Full Version : Script for Uploading to FTP Server




thriftinkid
Mar 27, 2008, 12:09 PM
Hey guys,

I trying to write two applescripts where one will reference the other for login info.

Basically, I want to use this to upload files onto an ftp server, but I want it to be flexible so I can use it on multiple systems.

This is what I'm looking to do:

Script 1: (All Info Should be Saved For Reference for Script 2)

1. Ask for Host name
2. Ask for User Name
3. Ask for Password.
4. Ask for port number
5. Startup FTP Application (Use info above and actually login)
5. Ask for destination upload folder
6. Save all info
7. Logout and quit application

Script 2: (To be used on selected file to upload)

1. Startup FTP Server application
2. Reference Script 1 for login info
3. Login.
4. Reference Script 1 for destination upload folder
5. Upload file
6. Log Out and Quit.

Any ideas on where to get started, or where I can go to find help? I've never written code, and I am learning on the fly. Thanks Guys!



ChrisA
Mar 27, 2008, 07:39 PM
Hey guys,

Script 2: (To be used on selected file to upload)

1. Startup FTP Server application
2. Reference Script 1 for login info


I think you ment "Startup FTP client ..."
I think many FTP clients will look for a file called .netrc and use usernames and passwords found in there. I don't like .netrc files for security reasons but if you are going to be storing this information this is the place because the any FTP client will know were to look. Go to the terminal and "man ftp" should explain this.

So your first script woud really be an editor for .netrc files

thriftinkid
Mar 28, 2008, 08:50 AM
I think you ment "Startup FTP client ..."
I think many FTP clients will look for a file called .netrc and use usernames and passwords found in there. I don't like .netrc files for security reasons but if you are going to be storing this information this is the place because the any FTP client will know were to look. Go to the terminal and "man ftp" should explain this.

So your first script woud really be an editor for .netrc files
I'm trying to do it in one script because it will be storing other usernames and passwords for other applications as well to reference, and I want the user to be able to put all the information in at once instead of having to run multiple reference scripts. Any way I could do that?

lee1210
Mar 28, 2008, 09:51 AM
I am not sure if keychain access is available from AppleScript, but that's what I would try. The keychain is designed to keep a database of usernames and passwords.

-lee

ChrisA
Mar 28, 2008, 11:05 AM
I am not sure if keychain access is available from AppleScript, but that's what I would try. The keychain is designed to keep a database of usernames and passwords.

-lee

Yes. You can read were I said I really do not like .netrc files. In fact if Apple script can't access the keychain I'd recommend abandening Applescript for this project and using something that can.

I thought that all you were doing was uploading some files to an FTP server. That's nearly trivel a one line script could do that if you used the .netrc idea but now you say there are other things to be done. It's a very bad idea to store passwords.