

#include #include #include #include #include #include #include #include #include enum /* Copy path + backslash + fn + \0. Start to examine a directory for listing with the functions NextDirectoryEntry(), DirectoryEntryName() and DirectoryEntryType(). The behavior upon symbolic links depends on the OS and the implementation of the Ada.Directories package. (As I expected.) ExamineDirectory with the pattern '.doc' matches. Then it steps down into each of the subdirectories. ExamineDirectory with the pattern '.a' matches. The solution first enumerates files in a directory, that includes the subdirectories, if their names match the pattern. Put_Line ( Full_Name ( Item )) end Print procedure Walk ( Item : Directory_Entry_Type ) is begin if Simple_Name ( Item ) /= "." and then Simple_Name ( Item ) /= "." then Walk ( Full_Name ( Item ), Pattern ) end if exception when Name_Error => null end Walk begin Search ( Name, Pattern, ( others => True ), Print ' Access ) Search ( Name, "", ( Directory => True, others => False ), Walk ' Access ) end Walk begin Walk ( ".", "*.adb" ) end Test_Directory_Walk WalkRecursive(1,"C:\visless\WORK\Win\Antismok\","\.With Ada.Directories use Ada.Directories with Ada.Text_IO procedure Test_Directory_Walk is procedure Walk ( Name : String Pattern : String ) is procedure Print ( Item : Directory_Entry_Type ) is begin Ada. log-files in the C:\Windows treeĮxamineDirectory(1,"C:\visless\WORK\Win\Antismok\","") If MatchRegularExpression(RegularExpression,DirectoryEntryName(dir))ĭebug "newdir "+newdir$ Here I got the folder address at this point. If DirectoryEntryType(dir) = #PB_DirectoryEntry_File File MD5 Using ExamineDirectory Post by georgej » Sat 10:01 am I am working on a small program to list all the files and their MD5 hash in a directory chosen by the user. WalkRecursive(dir+1,path+DirectoryEntryName(dir)+"\",Pattern)ĭebug "Error in "+path+DirectoryEntryName(dir) If ExamineDirectory(dir+1,path+DirectoryEntryName(dir),"")


An empty directory contains no files nor subdirectories.
#Purebasic examinedirectory code#
Newdir$=newdir$+"/"+DirectoryEntryName(dir) Empty directory - Rosetta Code Starting with a path to some directory, determine whether the directory is empty. It also includes an integrated and powerful debugger and profiler for code tracing and analysis. No external DLLs, runtime interpreter, or anything else took when generating. PureBasic 2022 is a complete and full-featured suite which provides all the necessary tools and functions for inspecting the code either in its entirety or by pieces for checking the accuracy of the code. A very quickly BASIC compiler, which generates highly optimized executables. If DirectoryEntryName(dir)"." And DirectoryEntryName(dir)"." PureBasic Great Features: Tremendous set of internal controls (1600+) to quickly and easily build games or applications. If DirectoryEntryType(dir)=#PB_DirectoryEntry_Directory DeleteDirectory() Syntax Result DeleteDirectory(Directory, Pattern, Mode) Description Deletes the specified Directory. RegularExpression=CreateRegularExpression(#PB_Any,Pattern) Start to examine a directory for listing with the functions NextDirectoryEntry (), DirectoryEntryName () and DirectoryEntryType (). Is there any Purebasic command to allow me to examine the entire tree down to the last folder?Ĭode: Select all Procedure.s WalkRecursive(dir,path.s,Pattern.s="\.txt$") If DirectoryEntryType(0) = #PB_DirectoryEntry_Fileĭebug DirectoryEntryName(0) + Type$ + "- Size in byte: " + Str(DirectoryEntrySize(0))īut his will give me only contents in one directory instead of contents of the sub and sub directories too unlike the DOS version "dir *.*/s " with a single command able to provide me with the details off all directories and subdirectories too. basic gui random-generation basic-learning educational variables simplicity purebasic for-beginners basic-programming. If ExamineDirectory(0, Directory$, "*.*") this is the directory of my PureBasic Projects, leave a star if you like it or fork a repo to collaborate.
#Purebasic examinedirectory plus#
This would give me all the directories and subdirectories plus all the files contained in there from the saved file tem.filĭirectory$ = "C:\visless\work\winw" Lists all entries in the Windows directory (without the contents of sub-directories) dir c:\visless\work\*.*/s >tem.fil at command line or shelling from it. Result ExamineDirectory (0, Folder, '.') If this is ok, begin enumeration of entries. I need to know the files and subdirectories to be displayed. ClearList ( Files ()) Open the directory to enumerate its contents. In my programming, I need to examine a directory/folder and the subdirectories.
