Page 1 of 1

Upload files on FTP

Posted: 05 Jan 2011 13:28
by olle24
Hello,

I have some questions about a script I found here that I have been using, this is the script:

@ftp -i -s:"%~f0"&GOTO:EOF <--- What does this line do?
open 31.359.58.107
test
test
!:--- FTP commands below here ---
ascii <--- Why use Ascii here? Is it depending on the files that I want to transfer? There are two more that I know of; Binary and Type, when should I use them?
cd BACKUP
put C:\Documents and Settings\####\".rtf" <-- How do I send files that have the ending .rtf?
disconnect
bye

I find the tutorials and the forums very useful and I am really grateful for this, trying to learn batch programming because it will certainly reduce the amount of time I am using on manual work.

Thank you for your time!

Best regards
Olle

Re: Upload files on FTP

Posted: 05 Jan 2011 14:50
by ChickenSoup
@ftp -i -s:"%~f0"&GOTO:EOF ----> This basically calls the batch file (itself) as the FTP script.

put C:\Documents and Settings\####\".rtf"

Try using

Code: Select all

mput C:\Documents and Settings\####\*.rtf


you may have to mess with "prompt" command to automate

Re: Upload files on FTP

Posted: 05 Jan 2011 17:57
by ghostmachine4
olle24 wrote:Hello,

I have some questions about a script I found here that I have been using, this is the script:

@ftp -i -s:"%~f0"&GOTO:EOF <--- What does this line do?
open 31.359.58.107
test
test
!:--- FTP commands below here ---
ascii <--- Why use Ascii here? Is it depending on the files that I want to transfer? There are two more that I know of; Binary and Type, when should I use them?
cd BACKUP
put C:\Documents and Settings\####\".rtf" <-- How do I send files that have the ending .rtf?
disconnect
bye

I find the tutorials and the forums very useful and I am really grateful for this, trying to learn batch programming because it will certainly reduce the amount of time I am using on manual work.

Thank you for your time!

Best regards
Olle


ascii is usually used for text files. For transferring binary files, for example Word document, or zip files, you use binary. And wrong, learning batch does not reduce the time on your manual work. It lacks a lot of things that useful programming language has, so you end up doing more , like creating workarounds, sometimes making your code inefficient. Try to learn a more productive tool, like vbscript/powershell if you are stuck on Windows. Or Perl/Python (2 more common scripting language). They are many times more useful than batch.