Solved

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

Posted on 2011-09-15
6
306 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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Novice question on VBScript 8 59
Compile Error 7 51
Windows updates batch files 7 40
msdos loop until a variable value changes 5 15
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…
Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

785 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