Getting folders and files from a drive and storing them..

Everything else that doesn't fall into one of the other PB categories.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Getting folders and files from a drive and storing them..

Post by dagcrack »

Hello, I've seen a thread about this b4, but now coudlnt find it and the link I've got, isnt working..

The idea is get each directory and file from a drive..
So I can store them.

Anyone knows?
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

dagcrack,

I guess you mean to parse a whole tree or sub-tree ...

Here is the recursive code I use :

Code: Select all

Global DirectoryLevel.l
Dim Directory.s(100)

Procedure ParseDirectory()
  If ExamineDirectory(DirectoryLevel, Directory(DirectoryLevel), "*.*")
      Repeat
        UseDirectory(DirectoryLevel)
        Type = NextDirectoryEntry()
        Select Type
          Case 0
          Case 1
            FileName.s = Directory(DirectoryLevel) + DirectoryEntryName()
            Debug FileName.s
          Case 2
            Name.s = DirectoryEntryName()
            If Name <> "." And Name <> ".."
                Name = Directory(DirectoryLevel) + Name + "\"
                DirectoryLevel + 1
                Directory(DirectoryLevel) = Name
                ParseDirectory()
                UseDirectory(DirectoryLevel)
            EndIf
        EndSelect
        Delay(5)
      Until Type = 0
  EndIf
  DirectoryLevel - 1
EndProcedure

;
;
;
  DirectoryLevel = 0
  Directory(DirectoryLevel) = "C:\InetPub\"
  ParseDirectory()
End
It does not list Folders (Case 2 where you can change it).
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

fweil, Thanks for your reply and snippet, helps me understand how to achive this.

btw, can I use part of your code for my project? (its a freeware proggy).
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

Does not matter if your code is free or not.

You can use it ...

Just add a banner to the user each time the program will use it !

Or do not add anything but remember I was part of your code ... :D
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

Isnt a credit with your name enought ? :P
Just your nick or your full name? in the case of the last one, give me your name :!:
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
fweil
Enthusiast
Enthusiast
Posts: 725
Joined: Thu Apr 22, 2004 5:56 pm
Location: France
Contact:

Post by fweil »

francois weil / fweil@internext.fr / www.francoisweil.com

Choose what you want part of all

Rgrds
My avatar is a small copy of the 4x1.8m image I created and exposed at 'Le salon international du meuble à Paris' january 2004 in Matt Sindall's 'Shades' designers exhibition. The original laminated print was designed using a 150 dpi printout.
dagcrack
Addict
Addict
Posts: 1868
Joined: Sun Mar 07, 2004 8:47 am
Location: Argentina
Contact:

Post by dagcrack »

All goes to the credits.
:D Cya.
! Black holes are where God divided by zero !
My little blog!
(Not for the faint hearted!)
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

here's a non-recursive one :-)

viewtopic.php?t=8359&highlight=xdir
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply