Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-09-15
6
Medium Priority
?
325 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 59

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
Industry Leaders: 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

by:
AlexPace earned 2000 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 59

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

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!

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…
When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

972 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