Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How do i create a list of files per directory?

Hello,

i would like to create a representation of the existing files per directory,
so that i can follow up the files i am keeping in the various data
directories i have (not the system).
I Know this information already exists in the system, and it is utilized by
Windows Explorer but i do not know how to access it and import it in Excell
or Access.

Any Help?
Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 182
Default How do i create a list of files per directory?

Costis,

You can use Dir function, here is the codes:

Sub DirFiles()
Dim MyDir, i As Integer
MyDir = Dir("C:\*.*")
While MyDir < ""
i = i + 1
Cells(i, "A") = MyDir
MyDir = Dir
Wend
End Sub

That represent filename only, unless you want to retrieve all the data of
files you have to use FileSystemObject Scripting metode

--

Regards,

Halim


"Costis" wrote:

Hello,

i would like to create a representation of the existing files per directory,
so that i can follow up the files i am keeping in the various data
directories i have (not the system).
I Know this information already exists in the system, and it is utilized by
Windows Explorer but i do not know how to access it and import it in Excell
or Access.

Any Help?
Thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 131
Default How do i create a list of files per directory?

You can use Dir:

Sub getFiles(startDir As String)

file = Dir(startDir & "\*.*")
i = 1

Do While file < ""
Sheets(1).Cells(i, 2) = file
i = i + 1
file = Dir
Loop

End Sub


You can also use the FileSystem object:

Sub getFiles1(startDir As String)

Set fso = CreateObject _
("Scripting.FileSystemObject")
Set folder = fso.GetFolder(startDir)

i = 1

For Each file In folder.Files
Sheets(1).Cells(i, 1) = file.Path
i = i + 1
Next

--
urkec


"Costis" wrote:

Hello,

i would like to create a representation of the existing files per directory,
so that i can follow up the files i am keeping in the various data
directories i have (not the system).
I Know this information already exists in the system, and it is utilized by
Windows Explorer but i do not know how to access it and import it in Excell
or Access.

Any Help?
Thanks in advance

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How do i create a list of files per directory?

Dear Halim,
thank you very mach for your help.
i guess i have to use VBA Excell which i dont know ...
.... going o study
thanks again



"Halim" wrote:

Costis,

You can use Dir function, here is the codes:

Sub DirFiles()
Dim MyDir, i As Integer
MyDir = Dir("C:\*.*")
While MyDir < ""
i = i + 1
Cells(i, "A") = MyDir
MyDir = Dir
Wend
End Sub

That represent filename only, unless you want to retrieve all the data of
files you have to use FileSystemObject Scripting metode

--

Regards,

Halim


"Costis" wrote:

Hello,

i would like to create a representation of the existing files per directory,
so that i can follow up the files i am keeping in the various data
directories i have (not the system).
I Know this information already exists in the system, and it is utilized by
Windows Explorer but i do not know how to access it and import it in Excell
or Access.

Any Help?
Thanks in advance

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default How do i create a list of files per directory?

Dear Urkec,
thank you for your help,
i shall have to learn the basics of VBA
be well

"urkec" wrote:

You can use Dir:

Sub getFiles(startDir As String)

file = Dir(startDir & "\*.*")
i = 1

Do While file < ""
Sheets(1).Cells(i, 2) = file
i = i + 1
file = Dir
Loop

End Sub


You can also use the FileSystem object:

Sub getFiles1(startDir As String)

Set fso = CreateObject _
("Scripting.FileSystemObject")
Set folder = fso.GetFolder(startDir)

i = 1

For Each file In folder.Files
Sheets(1).Cells(i, 1) = file.Path
i = i + 1
Next

--
urkec


"Costis" wrote:

Hello,

i would like to create a representation of the existing files per directory,
so that i can follow up the files i am keeping in the various data
directories i have (not the system).
I Know this information already exists in the system, and it is utilized by
Windows Explorer but i do not know how to access it and import it in Excell
or Access.

Any Help?
Thanks in advance

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to create links to all files in directory Edwin[_4_] Excel Programming 1 June 4th 06 09:52 PM
List of Files in A Directory JaneC Excel Discussion (Misc queries) 2 February 18th 06 12:11 PM
List Files in a Directory [email protected] Excel Programming 3 December 18th 05 12:13 AM
make a list of files in a directory GFN Excel Programming 2 July 29th 05 07:49 AM
Directory List of Excel Files No Name Excel Programming 6 May 18th 04 05:22 PM


All times are GMT +1. The time now is 08:09 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"