Organizing project files

I'm trying to clean up unused files. Over the years my.pjt has piled up about 400/800 files of all sorts (.prg, .scx, .vcx, .mnx, .bak, .ini, .xml, .vbr, .err, .dbf, .fpt., .txt, etc.): located in 10 directories ... which is just cluttering up those directories.

Is there any suggestable (lazy) way to re-organize and/or clean up (discard old unused files) or copy out only the my.pjt vital files (other than excluded report files, help files, and picture files).

Thanks in advance,



Answer this question

Organizing project files

  • Deepak Asani

    I just tackled the same problem the other day on a client project. Here's code to compare the list of files in specified directories to the list in a PJX/PJT:

    * Look for unused code

    MODIFY PROJECT <your project> nowait

    oProject = _VFP.ActiveProject
    * First, make a list of all files in project
    LOCAL aProjFiles[oProject.Files.Count]

    nCounter = 0
    FOR EACH oFile IN oProject.Files
    nCounter = nCounter + 1
    aProjFiles[nCounter] = UPPER(oFile.Name)
    ENDFOR

    CREATE CURSOR Unused (mFileName M)

    * Now traverse directories
    * First, make a list of directories
    CREATE CURSOR DirsToCheck (mDirName M)
    * Populate this cursor with one record for each directory you want to check

    LOCAL aFiles[1], cOldDir, cFile

    cOldDir = SET("Default") + CURDIR()

    SCAN
    CD ALLTRIM(mDirName)
    nFilesToCheck = ADIR(aFiles, "*.*")
    FOR nFile = 1 TO nFilesToCheck
    cFile = aFiles[nFile, 1]
    cExt = JUSTEXT(cFile)
    IF INLIST(cExt, "PRG", "SCX", "MNX", "FRX", "VCX", "QPR")
    IF ASCAN(aProjFiles, FORCEPATH(cFile, ALLTRIM(mDirName)), -1, -1, 1, 7) = 0
    INSERT INTO Unused VALUES (cFile)
    ENDIF
    ENDIF
    ENDFOR
    ENDSCAN

    CD (cOldDir)

    RETURN


    Tamar

  • Charley Lou

    The easiest thing to do is to create a new project file, put the MAIN.prg into it and tell VFP to BUILD PROJECT. It'll go through and add what is referenced by each item.

  • Amos Soma

    Thanks again, David, for your thoughtful feedback,

    That'll seem to help keep My.Pjt clean before dissecting out obsolete files; I'll have to test it though for 'included' vs. 'excluded' files and such.

    Thanks again for your invaluable feedback.


  • David Tatton

    Having used both schemes (Tamar's and David's) with minor alterations (Sunday evening) I was able to track down and *dissect-out* most unwanted project inclusions (via David) and most unwanted files (via Tamar) with little sequela.

    Thanks again for your help.


  • syndicate

    Extreme Thanks Tamar. This is invaluable. I believe I'll be able to run it through and dissect/list vital files accordingly from time to time.

    Again, much thanks.


  • Organizing project files