Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default using dir to get folder names

I am using dir(path, vbdirectory) to return the names of folders and files,
but instead of getting the folder name, I am getting "." How can I remedy
this.

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default using dir to get folder names

Write your code to ignore it.

.. is the shortcut for the current directory
... is the shortcut for the parent directory

In some versions of windows, you can go up the path with more and more dots.



pjryan wrote:

I am using dir(path, vbdirectory) to return the names of folders and files,
but instead of getting the folder name, I am getting "." How can I remedy
this.

Thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default using dir to get folder names

MyPath = "c:\"
MyName = Dir(MyPath, vbDirectory)
Do While MyName < ""
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
MsgBox(MyName)
End If
MyName = Dir()
Loop

If this post helps click Yes
---------------
Jacob Skaria


"pjryan" wrote:

I am using dir(path, vbdirectory) to return the names of folders and files,
but instead of getting the folder name, I am getting "." How can I remedy
this.

Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default using dir to get folder names

thanks - I know what the "." and ".." mean when listing directories and
folders, but it did not compute to me here! I did not let my loop continue
running to see what would come next. When "." showed up first, I panicked.
Thanks

"Dave Peterson" wrote:

Write your code to ignore it.

.. is the shortcut for the current directory
... is the shortcut for the parent directory

In some versions of windows, you can go up the path with more and more dots.



pjryan wrote:

I am using dir(path, vbdirectory) to return the names of folders and files,
but instead of getting the folder name, I am getting "." How can I remedy
this.

Thanks


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default using dir to get folder names

Sorry it is my oversight...the below is to extract folders alone...
--
If this post helps click Yes
---------------
Jacob Skaria


"Jacob Skaria" wrote:

MyPath = "c:\"
MyName = Dir(MyPath, vbDirectory)
Do While MyName < ""
If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
MsgBox(MyName)
End If
MyName = Dir()
Loop

If this post helps click Yes
---------------
Jacob Skaria


"pjryan" wrote:

I am using dir(path, vbdirectory) to return the names of folders and files,
but instead of getting the folder name, I am getting "." How can I remedy
this.

Thanks

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
Match file names listed in column with file names in folder K[_2_] Excel Programming 1 March 16th 09 04:26 PM
VBA help: need folder names [email protected] Excel Programming 5 February 17th 08 07:11 AM
How to List the names of the subfolders present in the folder (path of folder is given in the textbox by user ) divya Excel Programming 3 November 30th 06 11:34 AM
How to Get Folder Names GC. Excel Programming 19 November 19th 04 12:10 PM
Change names of files in a folder to match names in Excel Column saybut Excel Programming 4 February 9th 04 06:26 PM


All times are GMT +1. The time now is 08:43 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"