Hi,
I need to get all pbls files from my computer (C,D,E,etc..). I did checked the dirlist, dirselect functions. but no use...
Hi,
I need to get all pbls files from my computer (C,D,E,etc..). I did checked the dirlist, dirselect functions. but no use...
H Shameem,
I've attached a sample application to do what you want to do. It takes quite a while to run. (PB 2019 R3).
[EDIT] See my latest answer for the attachment.
It lists all pbl files of "all" Disk drives. I'm excluding all network mapped drives and some drives that I have for backups in the code though (E: and G:). You might want to change that. You can now select the drives you want to scan instead.
It's takes quite some time to finish! On my computer, running 2 complete SSD drives (450 GB and 250 GB) takes about 15 minutes. (the method that I suggested in another answer on this page, would work a lot faster, but has the inconvenience that you would have to run a batch file and write and read things from disk, cleanup etc.).
Instead of scanning full disks, it would be better to use a fixed list of some base directories (instead of the root folder. Imagine how much it takes to scan the windows related folders), but if you want to scan the whole disk from the root, including all subfolders, that's is what it's doing right now.
I've used n_filesys (by Roland Smith Topwizprogramming), but I've made some modifications since we are dealing with a recursive process and I didn't want the object to be auto-instantiate. It seems to behave a lot stabler when you create and destroy the object and do garbagecollect() and yield()).
Hi Shameem,
I accidentally posted the wrong sample application.
Here's the one for the search. (see attached). You have to look at the window "w_searchpbls_main".
[EDITED]
I've once again replaced the attachment: you can now select which disk(s) you want to scan and you can choose to exclude the windows and program files folders.
I've deleted the other attachment, so there's no more confusion.
Happy new year!
A)
If you want to use a batch file and know which driveletters you have, you can create a batch (.bat or .cmd) file and use the "run()" command in powerbuilder to execute it. If you redirect the output to a text file, you can then later open the text file into powerbuilder using FileOpen() and FilereadEx() in linemode and process every line.
For example:
string ls_run
ls_run = "myPBL.cmd > pblFiles.txt" // not sure if you need to use one ">" or ">>"
run (ls_run, minimized!)
MyPBL.cmd:
rem use /b to only get the path and pbl names:
dir C:\*.pbl /s /b
dir D:\*.pbl /s /b
B)
But a much cleaner solution is to use n_filesys. The functions that you need are there, but they are not named "search" or anything like that.
To get all drives, use this one:
// -----------------------------------------------------------------------------
// SCRIPT: n_filesys.of_GetDrives
//
// PURPOSE: This function returns a list of disk drives with their type
// and volume label.
//
// ARGUMENTS: as_drive - Drive letter array (By Ref)
// aul_type - Drive type array (By Ref)
// as_label - Volume label array (By Ref)
And to get all the files on a specific drive, use this one:
// -----------------------------------------------------------------------------
// SCRIPT: n_filesys.of_GetFiles
//
// PURPOSE: This function is a simplified version that only returns
// filename and subdirectory flag.
//
// ARGUMENTS: as_filespec - File path
// as_name - File Name array (By Ref)
// ab_subdir - Subdirectory flag (By Ref)
>> I need to search all PBLs from a computer (C,D,E......) . neet to list (Like Windows search..)
>> Powerbuilder code...
>> or applicable from batch file but which need to execute from powerbuilder
>> I did check with DirList and DirSelect.. In this case I need to select all folders. It is very complicated functionality.
Hi Shameem,
Please try to be more specific if you want some help:
regards
Happy new year.
I can't see any button or any function for search in the example application which you send to search pbls from a computer...
Show me a screenshot, maybe that will clear things up.