Solved

Extract File list / corresponding File size in a directory

Posted on 2004-04-28
6
190 Views
Last Modified: 2010-05-02
I would like to create a template (output could be text file or pasted directory to corporate email message using Outlook 2000) for an email notification of data transmission. The idea is to list all files in the source path with their corresponding file sizes. The source path is D:\4xmit\final\Today's Transmission wherein you would be able to locate the LET, TXT, ZIP, $$$, and XLS files, while image files (TIF files) can be located in 2 subfolders: D:\4xmit\final\Today's Transmission\black images, and D:\4xmit\final\Today's Transmission\white images.

What I would like to do is place the listing of LET and TXT right after the header "ftp.company.co.us\textandletfiles" (LET and TXT files can be found at "D:\4xmit\final\Today's Transmission" folder);

TIF files either at the following two headers: ftp.company.co.us\white images or ftp.company.co.us\black images, depending on where they can be found at D:\4xmit\final\Today's Transmission\black images or D:\4xmit\final\Today's Transmission\white images;

$$$ files after the header "ftp.company.co.us\billing" ($$$ files can be found at "D:\4xmit\final\Today's Transmission"; and

ZIP and XLS files after the header "ftp.company.co.us\quality" (ZIP and XLS files can be found at "D:\4xmit\final\Today's Transmission"


To illustrate, a template is provided below:

============================================================
Dear Sir:

We are pleased to inform you that the following files are already available in your FTP for your soonest receipt:

ftp.company.co.us\textandletfiles
textfile1.txt + filesize
letfile1.let + filesize
textfile2.txt + filesize
letfile2.let + filesize

ftp.company.co.us\white images
whiteimage1.tif + filesize
whiteimage2.tif + filesize
whiteimage3.tif + filesize

ftp.company.co.us\black images
blackimage1.tif + filesize
blackimage2.tif + filesize
blackimage3.tif + filesize

ftp.company.co.us\qualitysheets
excelfile1.xls + filesize
excelfile2.xls + filesize
zipfile1.zip + filesize
zipfile2.zip + filesize

ftp.company.co.us\billing
dollar1.$$$ + filesize
dollar2.$$$ + filesize

Should there be any problem, please don't hesitate to give us a call.

Warm Regards,

John

============================================================


Can anyone help me on this?

Thanks,

John
0
Comment
Question by:johndacs
[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
6 Comments
 
LVL 7

Accepted Solution

by:
ramesh12 earned 200 total points
ID: 10940972
dim fs as filesystemobject       '--------------make a reference to microsoft scripting runtime class


baseDir = yourbasedirtocheck ' make this your root folder     D:\4xmit\final\Today's Transmission
If fs.FolderExists(baseDir) Then
    Set fldr = fs.GetFolder(baseDir)
Else

Exit Sub
End If

Dim fldrName As String

dim item as folder
dim item1 as file
For Each item In fldr.SubFolders                
   
    Set subFldr = fs.GetFolder(item.Path)
    For Each item1 In subFldr.Files                       ' to check file path in subfolders
   
    ' you can get your filename here . If you want you can check their extension using right(item1.path,3)="xxx"
            
'add these filenames to a string like
'You can filter here based on extensions and add them to different strings

str1=str1 & item1.path & " - " & filelen(item1.path) & vbcrlf
   
    Next

Next

For Each item In fldr.files                   ' to check file path in folder itself
'add these filenames to a string like
'
'You can filter here based on extensions and add them to different strings
str1=str1 & item1.path & " - " & filelen(item1.path) & vbcrlf


Next
0
 

Author Comment

by:johndacs
ID: 10954482
ramesh12,

I'm gonna increase the points if you can give me the complete code. I'm not that well-verse in either Visual Basic or VBA.

Thanks,

John
0
 
LVL 22

Expert Comment

by:DarkoLord
ID: 11977281
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept ramesh12's comment as an answer

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

DarkoLord
EE Cleanup Volunteer
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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