Recent

Author Topic: [SOLVED]FindAllFiles works for folders/directories?  (Read 4033 times)

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
[SOLVED]FindAllFiles works for folders/directories?
« on: January 25, 2021, 10:19:02 pm »
Hi everyone
Using Lazarus 2.0.10 on win 8.1
Im trying to create my custom file explorer.


Code: Pascal  [Select][+][-]
  1. MyDirectory : String;
  2. listaarchivos : TStringList();
  3. MyDirectory := GetCurrentDir(); // example: c:\myproject
  4. FindAllFiles(listaarchivos, MyDirectory , '*.*', false);

It only gets the files in c:\myproject, but how i can get the folders inside this folder?
« Last Edit: January 26, 2021, 02:18:34 am by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: FindAllFiles works for folders/directories?
« Reply #1 on: January 25, 2021, 10:37:15 pm »
https://wiki.freepascal.org/FindAllFiles

If you want to recurse subfolders, then you need FALSE to be TRUE.
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: FindAllFiles works for folders/directories?
« Reply #2 on: January 25, 2021, 10:42:47 pm »
True lists the files in the subfolders of  c:\myproject
I want the name of the folders in  c:\myproject.
One image is better than 1000 words...

https://wiki.freepascal.org/FindAllFiles

If you want to recurse subfolders, then you need FALSE to be TRUE.
« Last Edit: January 25, 2021, 10:55:14 pm by torbente »
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

ASBzone

  • Hero Member
  • *****
  • Posts: 678
  • Automation leads to relaxation...
    • Free Console Utilities for Windows (and a few for Linux) from BrainWaveCC
Re: FindAllFiles works for folders/directories?
« Reply #3 on: January 25, 2021, 11:15:16 pm »
Then this is what you are looking for:

https://wiki.freepascal.org/fileutil

function FindAllDirectories(const SearchPath: string;  SearchSubDirs: Boolean = True): TStringList;
-ASB: https://www.BrainWaveCC.com/

Lazarus v2.2.7-ada7a90186 / FPC v3.2.3-706-gaadb53e72c
(Windows 64-bit install w/Win32 and Linux/Arm cross-compiles via FpcUpDeluxe on both instances)

My Systems: Windows 10/11 Pro x64 (Current)

torbente

  • Sr. Member
  • ****
  • Posts: 325
    • Noso Main Page
Re: FindAllFiles works for folders/directories?
« Reply #4 on: January 26, 2021, 02:18:13 am »
Thank you!

Then this is what you are looking for:

https://wiki.freepascal.org/fileutil

function FindAllDirectories(const SearchPath: string;  SearchSubDirs: Boolean = True): TStringList;
Noso Cryptocurrency Main Developer
https://github.com/DevTeamNoso/NosoWallet

 

TinyPortal © 2005-2018