Computing.Net > Forums > Programming > .BAT To use FTP and find first file in folder

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.

.BAT To use FTP and find first file in folder

Reply to Message Icon

Name: logank9
Date: July 1, 2009 at 08:12:06 Pacific
OS: Windows
Subcategory: Batch
Comment:

I would like to create a .bat file that finds the first file in a folder on an FTP server.

FTP Server
RandomFolder <- find the first file in this folder
index.html
^Stuff on server

I know I have to use the FTP command, but I'm not sure how. It'd be great if someone could help me with this! :D



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: July 1, 2009 at 08:27:41 Pacific
Reply:

First you need to state exact OS, like the forum guide says.

And you need to define 'first'; by what criteria.


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

M2


0

Response Number 2
Name: logank9
Date: July 1, 2009 at 08:36:48 Pacific
Reply:

Alright, sorry about that.

My exact OS would be Linux on the FTP server, and I'm running Windows 7.

By first, I mean the oldest file created I guess..


0

Response Number 3
Name: Mechanix2Go
Date: July 1, 2009 at 09:00:29 Pacific
Reply:

The listing I get is below. See what yours looks like. It's gonna be a bit messy.
=========================
-rw-r--r-- 1 ftpuser ftpusers 49 Oct 19 2005 1696.TXT
-rw-r--r-- 1 ftpuser ftpusers 816 Jan 9 2008 4.BAT
-rw-r--r-- 1 ftpuser ftpusers 34020 Jun 18 2004 APcfg.txt


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

M2


0

Response Number 4
Name: logank9
Date: July 1, 2009 at 09:22:27 Pacific
Reply:

Sorry if this is a bit newbish ( it is ) but I have no clue what you are trying to say. This is my first time ever using FTP.

Where do I find the listing?


0

Response Number 5
Name: Mechanix2Go
Date: July 1, 2009 at 09:32:56 Pacific
Reply:

Run this script and it will get list of files into a file om your PC called filelist.

==============================
:: put in your own details

@echo off

> d.ftp echo o mysite.com
>> d.ftp echo username
>> d.ftp echo password
>> d.ftp echo bin
>> d.ftp echo ls -l filelist
>> d.ftp echo bye

ftp -s:d.ftp


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

M2


0

Related Posts

See More



Response Number 6
Name: logank9
Date: July 1, 2009 at 09:44:10 Pacific
Reply:

Ah, thank you for your help, but I think I may have found a solution to my problem already... I didn't need to do all of this.


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: .BAT To use FTP and find first file in folder

c++ - find first file in directory? www.computing.net/answers/programming/c-find-first-file-in-directory/16516.html

Move the first file in a folder www.computing.net/answers/programming/move-the-first-file-in-a-folder-/19043.html

Find oldest file in folder www.computing.net/answers/programming/find-oldest-file-in-folder/14755.html