We help IT Professionals succeed at work.

Windows FTP client : scripting and scheduling

I want if possible to avoid installing a third party FTP client (something else to patch and maintain).
What is the best method to schedule the Windows FTP client to download all files with a given extension at a fixed time each day?
Comment
Watch Question

BRONZE EXPERT
Commented:
you can create a cmd file with the following lines
ftp -s commandfile.txt

command file will have
username
password
commands to download (e.g. prompt  and mget *.extention)
and you can schedule the cmd file to run whenever you want.
hope that helps
Commented:
Write down a .txt file with commands like:

open <IP _ADDRESS_OF_SERVER>
<username>
<password>
cd <The_Working_dir_you_want>
mget *.<ext>

Open in new window


Then, write down a .bat file with

@echo off
cd <the_dir_in_which_to_save>
ftp -s:<name_of_txt_commands_file>

Open in new window


Schedule the Batch with scheduled tasks


HTH
Bye!
BRONZE EXPERT

Commented:
i failed to mention the "ftp -s commandfile.txt ftp_host"

Author

Commented:
Brilliant. Got that! Now how do I avoid putting the password in a text file?
Can I create a local user on the FTP client machine, and run the script in the context of that user, and transfer the password to the FTP ?
Or something else. There will no always be a user present to put in the password.

Commented:
Perhaps use REGEDIT to read the password from the registry.  Perhaps using VBScript intead of a batch file would allow both reading the registry and launching ftp.exe.

As your FTP automation needs become more complex you might ultimately need to use  a 3rd party application like Robo-FTP that allows you to easily store all the connection details in the registry.  Other issues you may face with the native DOS ftp.exe include the inability to do secure transfers (FTPS and SFTP) and the inability to do Passive Mode data transfers.

Author

Commented:
Maybe I'll lok at the Powershell addin.

Commented:
Carlochi,
 keep in mind that windows FTP client is not a professional product and provides only basic features, cause it's not intended to be different.

You can workaround this by using tricks, but the best way is to use a product that is BORN to do what you want.

There was no trace of password encryption in intial requirements of your post, otherwise i'd suggest WINSCP, that can be scripted, keeps sessions with password saved (note that password storage is a weak security) and do a lot more things. You don't need to install anything, just start the executable.


HTH.

Author

Commented:
Only thought of the password when I saw it in plain text... As I said I don't want anything else to maintain and patch. (or forget to maintain and forget to patch).

Explore More ContentExplore courses, solutions, and other research materials related to this topic.