WalkRecursive(1,"C:\visless\WORK\Win\Antismok\","\. 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. Got an idea for enhancing PureBasic New command(s) youd like to see 1 post of 1. If Result Loop through until NextDirectoryEntry (0) becomes zero - indicating that there are no more entries. Result ExamineDirectory (0, Folder, '.') If this is ok, begin enumeration of entries. License file for PureBasic applications (without using 3D engine commands) License file for the 3D engine integrated with PureBasic. Folder GetHomeDirectory () Open the directory to enumerate all its contents. If DirectoryEntryType(dir) = #PB_DirectoryEntry_File Several PureBasic versions at once Migrating from an old version of PureBasic. WalkRecursive(dir+1,path+DirectoryEntryName(dir)+"\",Pattern)ĭebug "Error in "+path+DirectoryEntryName(dir) 59 PicoLisp 60 Pop11 61 PowerShell 62 Prolog 63 PureBasic 64 Prolog 65 Python 66 R 67 Racket 68 Raku 69 Rascal 70 REALbasic 71 Red 72 REXX. If ExamineDirectory(dir+1,path+DirectoryEntryName(dir),"") I think, it would be useful to have a /s parameter (or something else) in the Examinedirectory() command to search e.g. basic gui random-generation basic-learning educational variables simplicity purebasic for-beginners basic-programming. Newdir$=newdir$+"/"+DirectoryEntryName(dir) this is the directory of my PureBasic Projects, leave a star if you like it or fork a repo to collaborate. If DirectoryEntryName(dir)"." And DirectoryEntryName(dir)"." If DirectoryEntryType(dir)=#PB_DirectoryEntry_Directory RegularExpression=CreateRegularExpression(#PB_Any,Pattern) 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$") PureBasic Survival Guide a tutorial for using purebasic for windows 5. 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. If ExamineDirectory(0, Directory$, "*.*") 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) ![]() The application has various features such as its portability for platforms includes Windows, Linux, Mac OS and also support for both 32 and 64-Bit system architect. I need to know the files and subdirectories to be displayed. Start to examine a directory for listing with the functions NextDirectoryEntry (), DirectoryEntryName () and DirectoryEntryType (). PureBasic is a reliable and efficient language build in a flexible and friendly environment. PS: I think that the documentation ought to mention "." and "." on Win, and other similar cases on other OSs, so users can keep it in mind for cross-platform code's sake.In my programming, I need to examine a directory/folder and the subdirectories. Probably the best solution would be to have a collection of different PB examples/procedures to pick from to handle this (ie: cross-platform, platform-dependent, etc.).Ībout the "." and "." entries found on Windows, are there similar equivalents on Linux and Mac? In my code I already handle "." and "." on Win OS, but I was wondering if and what to except on Mac (which I don't have access to) in order to make it cross platform. So, any cross-platform code will have to take in account that on Win when retriving file/folder paths.įrom this thread it seems like there can't be a single solution to fit all needs. Code: Select all Path.s 'C:Windows' Name.s Path + 'w.' SearchHandle FindFirstFile(Name, Info. Windows will accept "/" as a path separator, but any commands dealing with file paths will always return "\" as a separator because it's Win default. No need to use a compiler directive to pre-select a '/' character or a '\' character, depending of the OS. ExamineDirectory Post by ClueLess Tue 10:42 am I've been struggling with exiaminedrectory with no success to get the directories and sub directories count and the size of the files on them. ![]() Olliv wrote:2nd remarkIt seems that '/' is cross-platform.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |