Solved

server file and directory list

Posted on 2004-04-23
6
140 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

863 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

22 Experts available now in Live!

Get 1:1 Help Now