Computing.Net > Forums > Programming > find newest file then send to ftp

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

find newest file then send to ftp

Reply to Message Icon

Name: robmhern
Date: April 4, 2009 at 15:47:56 Pacific
OS: Windows XP
Subcategory: Batch
Comment:

I need a send a daily backup file to ftp site. Is there a way to make a bat file that finds the newest file in directory then send to FTP site?


Thanks!

RM



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: April 4, 2009 at 16:07:40 Pacific
Reply:

@echo off & setLocal EnableDelayedExpansion

for /f "tokens=* delims=" %%a in ('dir/b/a-d/od') do (
set latest=%%a
)

> #.ftp echo o mysite.com
>> #.ftp echo username
>> #.ftp echo password
>> #.ftp echo bin
>> #.ftp echo put !latest!
>> #.ftp echo bye

ftp -s:#.ftp


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 2
Name: robmhern
Date: April 4, 2009 at 16:26:06 Pacific
Reply:

thanks for the quick response.

I set my login creds for the ftp, but I am getting a "maximum setlocal recursion level reache" response.

regards,

RM


0

Response Number 3
Name: Mechanix2Go
Date: April 4, 2009 at 16:34:26 Pacific
Reply:

lemme guess...

what did you call the script?


=====================================
If at first you don't succeed, you're about average.

M2


0

Response Number 4
Name: robmhern
Date: April 4, 2009 at 16:40:49 Pacific
Reply:

ftp.bat?

I am clueless with this.....


Thanks!


0

Response Number 5
Name: Mechanix2Go
Date: April 4, 2009 at 16:44:23 Pacific
Reply:

try latest.bat


=====================================
If at first you don't succeed, you're about average.

M2


0

Related Posts

See More



Response Number 6
Name: robmhern
Date: April 4, 2009 at 16:54:34 Pacific
Reply:

lol....

It works but it sent the bat file.........

the bat file is being run from the folder with files I want to send.

RM


0

Response Number 7
Name: Mechanix2Go
Date: April 5, 2009 at 00:17:58 Pacific
Reply:

Put it somewhere else and tell it where the los are.

================================
@echo off & setLocal EnableDelayedExpansion

for /f "tokens=* delims=" %%a in ('dir/b/a-d/od d:\mylogs') do (
set latest=%%a
)

> #.ftp echo o mysite.com
>> #.ftp echo username
>> #.ftp echo password
>> #.ftp echo bin
>> #.ftp echo put !latest!
>> #.ftp echo bye

ftp -s:#.ftp


=====================================
If at first you don't succeed, you're about average.

M2


0

Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: find newest file then send to ftp

batch script to upload to ftp www.computing.net/answers/programming/batch-script-to-upload-to-ftp/16987.html

Adding copy to c:\files on send to menu www.computing.net/answers/programming/adding-copy-to-cfiles-on-send-to-menu/261.html

VB Script to ftp files www.computing.net/answers/programming/vb-script-to-ftp-files/17951.html