From: LondonLad on
Hi
Finding folder extn's is fine but to just find a folder name within a folder
has me beat.
I have a folder named Music this has 900 sub folders by each artists name I
want to check the date modified for each sub folder.
I have looked at findfirst findnext API but not sure how to adapt it to find
sub folder names.
Can you help
From: Dee Earley on
On 12/07/2010 11:51, LondonLad wrote:
> Hi
> Finding folder extn's is fine but to just find a folder name within a folder
> has me beat.

Dave O replied to your original question over an hour ago.

--
Dee Earley (dee.earley(a)icode.co.uk)
i-Catcher Development Team

iCode Systems

(Replies direct to my email address will be ignored.
Please reply to the group.)
From: Dave O. on
Look, you are going to have to come clean if you want any help - what do you
know so far?

Incidentally, in my previous message I meant "FindFirstFile" &
"FindNextFile", not "FindFirst" & "FindNext" which I think are database
calls.

What is it you don't understand about these APIs, they are painfully easy
and to get all levels of subfolders you just make the routine recursive.

Goggling "VB6 FindFirstFile Recursive" returns 8,222 results, most of which
probably do exactly what I think you want - Does your internet provider
block Google? there really is no other excuse for not going there yourself
to work this out.

We were all beginners at some point, but you really should make some effort
to find out these things for yourself.

Regards
DaveO

"LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
news:BB07E72D-2F66-4A7B-AD5A-3781E5953CFD(a)microsoft.com...
> Hi
> Finding folder extn's is fine but to just find a folder name within a
> folder
> has me beat.
> I have a folder named Music this has 900 sub folders by each artists name
> I
> want to check the date modified for each sub folder.
> I have looked at findfirst findnext API but not sure how to adapt it to
> find
> sub folder names.
> Can you help


From: Nobody on
"LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
news:BB07E72D-2F66-4A7B-AD5A-3781E5953CFD(a)microsoft.com...
> Hi
> Finding folder extn's is fine but to just find a folder name within a
> folder
> has me beat.
> I have a folder named Music this has 900 sub folders by each artists name
> I
> want to check the date modified for each sub folder.
> I have looked at findfirst findnext API but not sure how to adapt it to
> find
> sub folder names.

Use InStrRev() to find the last two "\", and extract the subfolder name
using Mid function. Example:

Option Explicit

Private Sub Form_Load()
Dim pos1 As Long
Dim pos2 As Long

pos1 = InStrRev("C:\abc\def\ghi.txt", "\")
Debug.Print pos1
pos2 = InStrRev("C:\abc\def\ghi.txt", "\", pos1 - 1)
Debug.Print pos2
End Sub

Output:

11
7



From: Dave O. on

"Nobody" <nobody(a)nobody.com> wrote in message
news:i1f55t$u0h$1(a)speranza.aioe.org...
> "LondonLad" <LondonLad(a)discussions.microsoft.com> wrote in message
> news:BB07E72D-2F66-4A7B-AD5A-3781E5953CFD(a)microsoft.com...
>> Hi
>> Finding folder extn's is fine but to just find a folder name within a
>> folder
>> has me beat.
>> I have a folder named Music this has 900 sub folders by each artists name
>> I
>> want to check the date modified for each sub folder.
>> I have looked at findfirst findnext API but not sure how to adapt it to
>> find
>> sub folder names.
>
> Use InStrRev() to find the last two "\", and extract the subfolder name
> using Mid function. Example:
>
> Option Explicit
>
> Private Sub Form_Load()
> Dim pos1 As Long
> Dim pos2 As Long
>
> pos1 = InStrRev("C:\abc\def\ghi.txt", "\")
> Debug.Print pos1
> pos2 = InStrRev("C:\abc\def\ghi.txt", "\", pos1 - 1)
> Debug.Print pos2
> End Sub
>
> Output:
>
> 11
> 7

Oh, do you think that's what he meant, it is rather hard to tell.
Another way to break the path down is to use Split with the Backslash as the
delimiter - possibly an easier way to manipulate the path although unless
you allow for them, UNC paths can be entertaining when split.

Regards
Dave O.