I wish few commands for easy read registry values ...

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
Rumpel
New User
New User
Posts: 2
Joined: Tue Jun 26, 2012 3:49 pm

I wish few commands for easy read registry values ...

Post by Rumpel »

Hi.... :lol:

I wish few commands for easy read registry values - for example: getregvalue or writeregvalue or something else.

and I wish a command to read every file in a directory (recursive)


i would be very happy if this would be happen...... :wink:
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: I wish few commands for easy read registry values ...

Post by IdeasVacuum »

commands for easy read registry values
+1 from me. There are numerous examples on the forum on how to do this.
read every file in a directory (recursive)
Note entirely sure what you mean, can you expand?
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Rumpel
New User
New User
Posts: 2
Joined: Tue Jun 26, 2012 3:49 pm

Re: I wish few commands for easy read registry values ...

Post by Rumpel »

read every file in a directory (recursive)
Note entirely sure what you mean, can you expand?[/quote]

Code: Select all

  Directory$ = "C:\"   
  If ExamineDirectory(0, Directory$, "*.*")  
    While NextDirectoryEntry(0)
      If DirectoryEntryType(0) = #PB_DirectoryEntry_File
        Type$ = " [File] "
      Else
        Type$ = " [Sub-Dir] "
      EndIf
      
      Debug DirectoryEntryName(0) + Type$ + "- size in bytes: " + Str(DirectoryEntrySize(0))
    Wend
    FinishDirectory(0)
  EndIf

this list all files in a directory, but no subdirectorys are listed....
a command to list / read / write all files in all (sub)directorys would be great.
thats what i mean.
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: I wish few commands for easy read registry values ...

Post by skywalk »

You must put another loop around the ExamineDirectory().
That way, you can search within each new directory you find.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: I wish few commands for easy read registry values ...

Post by IdeasVacuum »

This is elsewhere on the forum, fast.

Code: Select all

Procedure ListFilesRecursive(Dir.s, List Files.s())
  NewList Directories.s()
  If Right(Dir, 1) <> "\"
    Dir + "\"
  EndIf
  D = ExamineDirectory(#PB_Any, Dir, "")
  While NextDirectoryEntry(D)
    Select DirectoryEntryType(D)
      Case #PB_DirectoryEntry_File
        AddElement(Files())
        Files() = Dir + DirectoryEntryName(D)
      Case #PB_DirectoryEntry_Directory
        Select DirectoryEntryName(D)
          Case ".", ".."
            Continue
          Default
            AddElement(Directories())
            Directories() = Dir + DirectoryEntryName(D)
        EndSelect
    EndSelect
  Wend
  FinishDirectory(D)
  ForEach Directories()
    ListFilesRecursive(Directories(), Files())
  Next
EndProcedure

NewList F.s()
ListFilesRecursive("D:\Temp\", F())
ForEach F()
  Debug F()
Next
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Post Reply