LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-29-2012, 05:07 AM   #1
ted_chou12
Member
 
Registered: Aug 2010
Location: Zhongli, Taoyuan
Distribution: slackware, windows, debian (armv4l GNU/Linux)
Posts: 431
Blog Entries: 32

Rep: Reputation: 3
bat files and ftp


Hi, I have several quesionts about the cmd for windows, (I do realize this is a linux forum).
I am trying to create a bat file that automatically fetches file off ftp server and loads onto a device that I order it to.
But the folder on the remote ftp server has hundreds of files in it (backups that my machine uploads regularly). I am trying to fetch the latest file. I think this can either be known from the datetime of the file and the name that I gave it:
Code:
120611_script.tgz
120715_script.tgz
...
The names are yymmdd_script.tgz, but I am not sure how I can get the latest one instead of them all.
I am about to start the code
Code:
OPEN ftp.hotfile.com
account
password
dir
...
Thanks
Ted
 
Old 07-29-2012, 08:07 PM   #2
rigor
Member
 
Registered: Sep 2003
Location: 19th moon ................. ................Planet Covid ................Another Galaxy;............. ................Not Yours
Posts: 705

Rep: Reputation: Disabled
There should be a variety of ways to do it, and it can potentially depend on what FTP client you are using. But you should be able to find an FTP client that allows the transfer of a single file with a command such as get. As long as the time at which you retrieve the back up file is in sync with the time the process runs that creates the backup, you should at least be able to put together a BAT file from up to three pieces. You could put any commands that need to be executed before the get command in one file, and any commands that need to be executed after the get command in another file. Finally you could dynamically create the get command text into a third file. Then just concatenate the three files to form the final BAT file. The overall process of creating the final BAT file could potentially be in another BAT file, or at the very least a script from within something like Cygwin.

If that doesn't help you, then perhaps you could give us the details of how you are trying to go about it, and what you view as the difficulties in doing it.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Like .bat files elico Linux - General 5 03-22-2012 10:49 AM
Delete all .log files and .bat files except the most recent? alancampbell6 Linux - Newbie 3 12-15-2011 09:17 AM
i dont like bat files spooge Slackware 6 06-29-2011 12:22 AM
reg:Bat Files Iyyappan Linux - General 1 05-06-2009 05:49 PM
echo bat files HELP jollyjoice Programming 5 11-02-2005 02:53 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration