Solved

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

Posted on 2011-09-15
6
310 Views
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?

Thanks
Yashy
0
Comment
Question by:Yashy
6 Comments
 
LVL 53

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

~bp
0
 
LVL 10

Expert Comment

by:ReneGe
ID: 36545694
Is your FTP folder local or remote?
0
 
LVL 1

Author Comment

by:Yashy
ID: 36548366
The FTP folder is remote
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 16

Accepted Solution

by:
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 "ftp.mydomain.com" /user="UserID" /pw="Secret"
* process directory listing returned by FTP server
:look_for_folder
GETSITEFILE "*" /next /incldirs
IFERROR GOTO done
* skip files in the directory listing
IFSTRCMP %sitedir "" GOTO look_for_folder
WRITEFILE output_file %sitedir /append
GOTO look_for_folder
:done
FTPLOGOFF

Open in new window


 
0
 
LVL 1

Author Comment

by:Yashy
ID: 36548773
Genius Alex. Thanks man.
0
 
LVL 53

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.

~bp
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I met Paul Devereux (@pdevereux) today when I responded to his tweet asking “Anybody know how to automate adding files from disk to a folder in #outlook  ?”.  I replied back and told Paul that using automation, in this case scripting, to add files t…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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