Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VFP 6 List of prg files in project and their directory 2

Status
Not open for further replies.

eric43

Programmer
Apr 29, 2005
94
AU
IS it possible to get ( or is their a piece of code that provides) a list of prg files in a project and their folder/directory?

Thanks

Eric
 
The Project file is in dbf format. You can USE it and then extract the information you want from the Name field.

Code:
USE MyProj.Pjx
SELECT name FROM MyProj WHERE type="P"

With a bit more effort you can use the JustPath() and JustFName() functions to extract the path and filename from the value in the Name field.

The path is relative to the project's home folder. You can get this from the HomeDir field:

Code:
SELECT HomeDir FROM MyProj WHERE type="H"

I've used SQL but if you just need a listing then it might be easier to just USE MyProj.Pjx and run the Report Wizard.

One last thing - which must come first.

[red]MAKE A BACKUP OF THE PROJECT[/red]

Geoff Franklin
 
In addition to Geoff's solution, from VFP 6 forward, you can address an open project as an object and it has a Files collection:

oProj = _VFP.ActiveProject
FOR EACH oFile IN oProj.Files
IF oFile.Type = "P"
* This is a prg.
?oFile.Name && includes the path, but you could parse it
ENDIF
ENDFOR

Obviously, you can do a lot more than just print out the name.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top