Home All Groups Group Topic Archive Search About

Folders- First layer only

Author
23 Sep 2005 3:31 PM
Kevin J Prince
Greetings,

Anyone have a routine already written that will
a. look at a piece of media (whatever drive pointed at)
b. read in the folders (only the first level and NO files)
c. save them in a text file (or as a string)

If it already exists then it would save me a few hours.

The plot is  to be able to run a program which will do the above and add
each media into a list/database which can then be searched. Possibility
of a few hundred CD's or Floppies..


--
Kevin J Prince
Skype address  princy557

Author
23 Sep 2005 4:32 PM
Ken Halter
Show quote Hide quote
"Kevin J Prince" <ke***@princ7.demon.co.uk> wrote in message
news:htT9pgBi$BNDFAYG@lon1-aj2b.demonadsl.co.uk...
>
> Greetings,
>
> Anyone have a routine already written that will
> a. look at a piece of media (whatever drive pointed at)
> b. read in the folders (only the first level and NO files)
> c. save them in a text file (or as a string)
>
> If it already exists then it would save me a few hours.
>
> The plot is  to be able to run a program which will do the above and add
> each media into a list/database which can then be searched. Possibility of
> a few hundred CD's or Floppies..
>
>
> --
> Kevin J Prince
> Skype address  princy557

This'll grab a list of folders starting from the path you pass. As coded,
it'll return all folders on the C: drive. Note that it won't return
hidden/system folders.
'===========
Option Explicit

Private Sub Command1_Click()
   Dim i As Integer
   Dim oColl As Collection
   Set oColl = GetList("C:")
   For i = 1 To oColl.Count
      Debug.Print i, oColl(i)
   Next
End Sub

Private Function GetList(StartPath As String) As Collection
   'Returns an unsorted list of folders
   'If you need 'sorted', add the results to a sorted listbox
   Dim sFolderName As String
   Dim lAttr As Long
   Dim sPath As String
   Dim oRet As Collection

   'Add a backslash if required
   sPath = StartPath & IIf(Right$(StartPath, 1) = "\", "", "\")

   Set oRet = New Collection

   sFolderName = Dir(sPath & "*.*", vbDirectory)

   Do
      If Len(sFolderName) > 0 Then
         lAttr = GetAttr(sPath & sFolderName)
         'Verify that it's a folder
         If (lAttr Or vbDirectory) = lAttr Then
            oRet.Add sFolderName
         End If
      End If
      sFolderName = Dir
   Loop While Len(sFolderName) > 0

   Set GetList = oRet
End Function
'===========

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
Author
23 Sep 2005 5:16 PM
Kevin J Prince
Ken,

Your a star pal, that'll save me a few hours work...

Will try it all now..

Regards Kevin


In message <ugZDqxFwFHA.2***@TK2MSFTNGP15.phx.gbl>, Ken Halter
<Ken_Halter@Use_Sparingly_Hotmail.com> writes
Show quoteHide quote
>"Kevin J Prince" <ke***@princ7.demon.co.uk> wrote in message
>news:htT9pgBi$BNDFAYG@lon1-aj2b.demonadsl.co.uk...
>>
>> Greetings,
>>
>> Anyone have a routine already written that will
>> a. look at a piece of media (whatever drive pointed at)
>> b. read in the folders (only the first level and NO files)
>> c. save them in a text file (or as a string)
>>
>> If it already exists then it would save me a few hours.
>>
>> The plot is  to be able to run a program which will do the above and add
>> each media into a list/database which can then be searched. Possibility of
>> a few hundred CD's or Floppies..
>>
>>
>> --
>> Kevin J Prince
>> Skype address  princy557
>
>This'll grab a list of folders starting from the path you pass. As coded,
>it'll return all folders on the C: drive. Note that it won't return
>hidden/system folders.
>'===========
>Option Explicit
>
>Private Sub Command1_Click()
>   Dim i As Integer
>   Dim oColl As Collection
>   Set oColl = GetList("C:")
>   For i = 1 To oColl.Count
>      Debug.Print i, oColl(i)
>   Next
>End Sub
>
>Private Function GetList(StartPath As String) As Collection
>   'Returns an unsorted list of folders
>   'If you need 'sorted', add the results to a sorted listbox
>   Dim sFolderName As String
>   Dim lAttr As Long
>   Dim sPath As String
>   Dim oRet As Collection
>
>   'Add a backslash if required
>   sPath = StartPath & IIf(Right$(StartPath, 1) = "\", "", "\")
>
>   Set oRet = New Collection
>
>   sFolderName = Dir(sPath & "*.*", vbDirectory)
>
>   Do
>      If Len(sFolderName) > 0 Then
>         lAttr = GetAttr(sPath & sFolderName)
>         'Verify that it's a folder
>         If (lAttr Or vbDirectory) = lAttr Then
>            oRet.Add sFolderName
>         End If
>      End If
>      sFolderName = Dir
>   Loop While Len(sFolderName) > 0
>
>   Set GetList = oRet
>End Function
>'===========
>

--
Kevin J Prince
Skype address  princy557
Author
23 Sep 2005 5:47 PM
Mike Williams
"Kevin J Prince" <ke***@princ7.demon.co.uk> wrote in message
news:GPgURECshDNDFA$h@lon1-aj2b.demonadsl.co.uk...

> Ken, Your a star pal, that'll save me a few hours work...

I was gonna send you some code as well Kevin, but just before I clicked the
"Send" button I saw that Ken had already sent you an answer . . . and now
he's been awarded a star! That's not fair :-(
Can I have a star as well Kevin? Go on. Just a little one. I only missed the
boat by a few minutes!

Mike
Author
23 Sep 2005 6:26 PM
Ken Halter
Show quote Hide quote
"Mike Williams" <M***@WhiskyAndCoke.com> wrote in message
news:dh1f3r$cut$1@news7.svr.pol.co.uk...
> "Kevin J Prince" <ke***@princ7.demon.co.uk> wrote in message
> news:GPgURECshDNDFA$h@lon1-aj2b.demonadsl.co.uk...
>
>> Ken, Your a star pal, that'll save me a few hours work...
>
> I was gonna send you some code as well Kevin, but just before I clicked
> the "Send" button I saw that Ken had already sent you an answer . . . and
> now he's been awarded a star! That's not fair :-(
> Can I have a star as well Kevin? Go on. Just a little one. I only missed
> the boat by a few minutes!
>
> Mike

LOL.... I hear you can buy a star on eBay. Does that help? ;-)

--
Ken Halter - MS-MVP-VB - http://www.vbsight.com
DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm
Please keep all discussions in the groups..
Author
25 Sep 2005 3:59 PM
DanS
Kevin J Prince <ke***@princ7.demon.co.uk> wrote in news:htT9pgBi
$BNDF***@lon1-aj2b.demonadsl.co.uk:

Show quoteHide quote
>
> Greetings,
>
> Anyone have a routine already written that will
> a. look at a piece of media (whatever drive pointed at)
> b. read in the folders (only the first level and NO files)
> c. save them in a text file (or as a string)
>
> If it already exists then it would save me a few hours.
>
> The plot is  to be able to run a program which will do the above and add
> each media into a list/database which can then be searched. Possibility
> of a few hundred CD's or Floppies..
>
>

Hey Kevin,

I already have that program written :) (80%).

It actually throws everything into an Access database. Displays by title,
or by CD.

I made the mistake of burning a couple hundred CD's without cataloging them
as I went along. I then found no good solution to 'back' catalog them, so
ended up 3/4 writing one myself. (I did find one, Sheridan Disk Cataloger,
but it did not run under NT/XP)

some features are not complete yet though, like printing a report. It has
the feature of being able to store a text file in one of the db fields so
you can read the info file w/o having to put in the CD. The search function
will only search thru the 'title' field though, as the next step was to add
a feature to search thru the info file filed.

On the scan, it only reports the top-level folder names. I wrote it so I
don't have to type anything in (almost). You can go to one of the folders
it reports, then click on it to make it editable. You can then highlight
areas of the folder title, and right-click to get the context menu, which
you can send the highlighted info to the correct field for that title,
either 'Cut to' or 'Set to', meaning it will cut the highlight from the
title field, or just copy it to the field you have destined for it.

Also, you can click on a folder and select 'View Text Files'. That will
open a text file viewer with all text files shown. you then highlight one
and it is displayed. Then you can highlight fields in the text files to
send to the appropriate field for the record as well. There a couple of
features there that I tough were pretty cool. One is that you can highlight
a bit of text, say the title, then select 'Set as Title - Remove .'s',
which will take the highlighted title, say 'My.Program.2005', and put it in
the title field w/o the dots, 'My Program 2005'. (I thought this was coded
in already, as the context menu choice is there, and I swear I wrote the
code for it, but for some reason, it doesn't work.)

The other feature I had to put in was 'make file list' and this could be
placed in the 'Info File field'. For instance, you have a folder named
'Graphics Tutorials', that contain's 50 tutorial's for using different
graphics programs, say 50 .pdf files. The 'make file list' function will
make a list of those 50 files and put them in the 'info file' field.

Anyway, a 'work in progress', that has seen no progress for probably a year
now, but usable as it is.

If you want to take on finishing it up yourself, FOR YOUR OWN USE ONLY, you
are welcome to a copy of the source if you wish. :)

(not too much remarked in it though, and is the first iteration at this
program)

a few screenshots in a zip file: http://users.adelphia.net/
~thisnthat/cdcat_screenshots.zip

Fix my displayed e-mail address by removing all dots except one of the
double's at the end if interested in the source.

Regards,

DanS
Author
26 Sep 2005 6:11 AM
Kevin J Prince
Dan,

Tried emailing, it got rejected But basically yes please to the code.

Regards KEvin


In message <Xns96DC7AA37510Aidispcom@216.196.97.142>, DanS
<t.h.i.s.n.t.h.a.t@a.d.e.l.p.h.i.a.?.n.e.t.invalid> writes
Show quoteHide quote
>Kevin J Prince <ke***@princ7.demon.co.uk> wrote in news:htT9pgBi
>$BNDF***@lon1-aj2b.demonadsl.co.uk:
>
>>
>> Greetings,
>>
>> Anyone have a routine already written that will
>> a. look at a piece of media (whatever drive pointed at)
>> b. read in the folders (only the first level and NO files)
>> c. save them in a text file (or as a string)
>>
>> If it already exists then it would save me a few hours.
>>
>> The plot is  to be able to run a program which will do the above and add
>> each media into a list/database which can then be searched. Possibility
>> of a few hundred CD's or Floppies..
>>
>>
>
>Hey Kevin,
>
>I already have that program written :) (80%).
>
>It actually throws everything into an Access database. Displays by title,
>or by CD.
>
>I made the mistake of burning a couple hundred CD's without cataloging them
>as I went along. I then found no good solution to 'back' catalog them, so
>ended up 3/4 writing one myself. (I did find one, Sheridan Disk Cataloger,
>but it did not run under NT/XP)
>
>some features are not complete yet though, like printing a report. It has
>the feature of being able to store a text file in one of the db fields so
>you can read the info file w/o having to put in the CD. The search function
>will only search thru the 'title' field though, as the next step was to add
>a feature to search thru the info file filed.
>
>On the scan, it only reports the top-level folder names. I wrote it so I
>don't have to type anything in (almost). You can go to one of the folders
>it reports, then click on it to make it editable. You can then highlight
>areas of the folder title, and right-click to get the context menu, which
>you can send the highlighted info to the correct field for that title,
>either 'Cut to' or 'Set to', meaning it will cut the highlight from the
>title field, or just copy it to the field you have destined for it.
>
>Also, you can click on a folder and select 'View Text Files'. That will
>open a text file viewer with all text files shown. you then highlight one
>and it is displayed. Then you can highlight fields in the text files to
>send to the appropriate field for the record as well. There a couple of
>features there that I tough were pretty cool. One is that you can highlight
>a bit of text, say the title, then select 'Set as Title - Remove .'s',
>which will take the highlighted title, say 'My.Program.2005', and put it in
>the title field w/o the dots, 'My Program 2005'. (I thought this was coded
>in already, as the context menu choice is there, and I swear I wrote the
>code for it, but for some reason, it doesn't work.)
>
>The other feature I had to put in was 'make file list' and this could be
>placed in the 'Info File field'. For instance, you have a folder named
>'Graphics Tutorials', that contain's 50 tutorial's for using different
>graphics programs, say 50 .pdf files. The 'make file list' function will
>make a list of those 50 files and put them in the 'info file' field.
>
>Anyway, a 'work in progress', that has seen no progress for probably a year
>now, but usable as it is.
>
>If you want to take on finishing it up yourself, FOR YOUR OWN USE ONLY, you
>are welcome to a copy of the source if you wish. :)
>
>(not too much remarked in it though, and is the first iteration at this
>program)
>
>a few screenshots in a zip file: http://users.adelphia.net/
>~thisnthat/cdcat_screenshots.zip
>
>Fix my displayed e-mail address by removing all dots except one of the
>double's at the end if interested in the source.
>
>Regards,
>
>DanS
>
>
>
>
>

--
Kevin J Prince
Skype address  princy557
Author
26 Sep 2005 12:22 PM
DanS
Kevin J Prince <ke***@princ7.demon.co.uk> wrote in
news:Ji$y7nBVE5NDFA8e@lon1-aj2b.demonadsl.co.uk:

> Dan,
>
> Tried emailing, it got rejected But basically yes please to the code.
>
> Regards KEvin
>
>

After work today, I'll sort through the project and make up a zip file to
get to you.

I'll probably just post it to the website i threw the screenshots on.

DanS