[Gambas-user] rdir returns unwanted directories
Gianluigi
bagonergi at ...626...
Sun May 28 22:43:03 CEST 2017
Finally, it's all clear to me as well.
In my example, just change the code like this:
Print File.Name(s)
Thank you Tobias
Regards
Gianluigi
2017-05-28 19:29 GMT+02:00 Tobias Boege <taboege at ...626...>:
> On Sun, 28 May 2017, Gianluigi wrote:
> > Hi Tobias,
> > if I have in my home a directory named image with a subfolder named
> > my-image, containing both images, and I write:
> >
> > Public Sub Main()
> >
> > Dim sFileArray As String[]
> > Dim s As String
> > Dim sPath As String = "~/image"
> > ' Run directory e sub-directory
> > sFileArray = RDir(sPath, "*.{png,jpg}", gb.File)
> > For Each s In sFileArray
> > Print s
> > Next
> >
> > End
> >
> > I obtain this:
> >
> > my-image/actress.png
> > my-image/alfa.jpg
> > my-image/lamb.jpg
> > snail.jpg
> > horse.jpg
> > oggy.png
> > sparkle.png
> > homer.jpg
> >
> >
> > In the first three cases, to get the only file name, I need your
> suggestion.
> >
> > Do not work so RDir to you?
> >
>
> Oh, now the whole thread makes sense to me! I thought your problem was that
> if you have a *directory* named "x.jpg" and issued
>
> RDir(..., "*.{png,jpg}", gb.File)
>
> the gb.File filter was ignored and you were reported the directory "x.jpg",
> because the "*.{png,jpg}" pattern matched. But you just wanted to get rid
> of
> the directory component. Then you have your solution (use File.Name on s)
> and there is no problem. Our RDir()s behave the same.
>
> Regards,
> Tobi
>
> --
> "There's an old saying: Don't change anything... ever!" -- Mr. Monk
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list