Solved

server file and directory list

Posted on 2004-04-23
6
144 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
[X]
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
  • 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

Technology Partners: 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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

738 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