How to output folder names in FTP folder into a text file ?

Posted on 2011-09-15
Last Modified: 2012-05-12
Chaps, is there a way to copy all of the folder names within an FTP folder and output it to text? Either with a batch file or just by command prompt?

We've logged on with the command prompt in windows, then used the command:

dir *.* /b >> filenames.txt

This doesn't work. Any ideas?

Question by:Yashy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 54

Expert Comment

by:Bill Prew
ID: 36544677
I can't recal if Windows FTP client supports this, but seems to me we used to this on unix.

dir . filenames.txt

Open in new window

LVL 10

Expert Comment

ID: 36545694
Is your FTP folder local or remote?

Author Comment

ID: 36548366
The FTP folder is remote
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 16

Accepted Solution

AlexPace earned 500 total points
ID: 36548456
You could do this with a Robo-FTP script.  Here is an example that parses a directory listing returned by the FTP server and writes only the names of the folders to a file. To make it work you'll need to change the login information on the FTPLOGON command line (4th line) but it should otherwise work for you.
SET output_file = "c:\ftp_folder_list.txt"
* remove existing file so we start with an empty one
DELETE output_file  
FTPLOGON "" /user="UserID" /pw="Secret"
* process directory listing returned by FTP server
GETSITEFILE "*" /next /incldirs
* skip files in the directory listing
IFSTRCMP %sitedir "" GOTO look_for_folder
WRITEFILE output_file %sitedir /append
GOTO look_for_folder

Open in new window


Author Comment

ID: 36548773
Genius Alex. Thanks man.
LVL 54

Expert Comment

by:Bill Prew
ID: 36548778
Did my first post not work for you, seems to work for me using the base Windows FTP client.  The same approach works with the ls subcommand as well, if you just want names and no size / date info.


Featured Post

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT ( The crux of this batch f…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question