Page 1 of 1

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

Posted: Tue Jun 26, 2012 3:54 pm
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:

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

Posted: Tue Jun 26, 2012 4:44 pm
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?

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

Posted: Tue Jun 26, 2012 5:21 pm
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.

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

Posted: Tue Jun 26, 2012 5:29 pm
by skywalk
You must put another loop around the ExamineDirectory().
That way, you can search within each new directory you find.

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

Posted: Tue Jun 26, 2012 7:54 pm
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