Solved

server file and directory list

Posted on 2004-04-23
6
139 Views
Last Modified: 2010-05-02
i have a dedicated server that i connect to via ftp to upload and download my websites.

over time i have accumulated over 10000 pages in many different directories.

is there a way that i could write a program that ftps into my server and writes to a text file every filename and folder that its in?

i have found many examples of ftp code but i don't know how i would extract all the info into a file
0
Comment
Question by:Marcusw
  • 2
6 Comments
 
LVL 11

Expert Comment

by:jmwheeler
ID: 10900754
I imagine you could work with fso.  Add a reference to 'Microsoft Scripting Runtime' in your project and try this:

'This will create a text file listing every file and folder on a persons C: drive.  You will need to tweak it to work for ftp.  Somehow you will need to link svr to the server and not to the
'hard drive also fldr will need to be set to the root folder you want start with.
'Set svr = fso.GetDrive("C:\")     should need to be something like   Set svr = fso.GetDrive("\\ServerName\Whatever\")
'Set fldr = fso.GetFolder("C:\")

Option Explicit

Private fso As FileSystemObject
Private svr As Drive
Private fldr As Folder
Private fldr2 As Folder
Private fldr3 As Folder
Private fl As File

Private Sub Form_Load()
    Open "C:\OutputFile.txt" For Output As #1

    Set fso = CreateObject("Scripting.FileSystemObject")
    Set svr = fso.GetDrive("C:\")
    Set fldr = fso.GetFolder("C:\")
   
    Print #1, "C:\"
    For Each fl In fldr.Files
        Print #1, vbTab & fl.Name
    Next
   
    For Each fldr2 In fldr.SubFolders
        Print #1, fldr2.Path
        GetFiles fldr2
    Next
   
    Close #1
    MsgBox ("Finished")
End Sub

Private Sub GetFiles(fldr2 As Folder)
    For Each fl In fldr2.Files
        Print #1, vbTab & fl.Name
    Next
   
    For Each fldr3 In fldr2.SubFolders
        Print #1, fldr3.Path
        GetFiles fldr3
    Next
End Sub
0
 

Author Comment

by:Marcusw
ID: 10919606
thanks jim i am having trouble with your code though, every time i try to run it as is it produces the following error

user defined type not defined

and highlights

Private Sub GetFiles(fldr2 As Folder)

any ideas
0
 

Author Comment

by:Marcusw
ID: 10947190
ive sorted the problem but i cannot get it to connect to my server, could anybody give me the code to connect with thanks
0
 
LVL 5

Accepted Solution

by:
Netminder earned 0 total points
ID: 11447661
PAQed, with points refunded (400)

Netminder
Site Admin
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

708 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now