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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cleaning up a project's folder. 2

Status
Not open for further replies.

Jerim65

Technical User
Aug 8, 2010
99
AU
As I develop my app, I get variations of my prg files and forms etc where I have saved the old ones from time to time.

To back up all these unused files EACH time is wasteful.

Is there some code for a cleanup of the files so that only those actually in a project after a Build command are left in the folder?

Thanks

Coldan
 
Hi Coldan,

You can certainly write code to loop through the project to find out which files are there, but I wonder if that would do what you want.

You say you only want to retain the files that are still in the project after the build. But the build doesn't remove files from the project. If you had an unwanted file in the project before the build, it will still be there after.

You might be better to keep a separate folder for your unwanted files, and get into the habit of moving them to that folder as soon as you decide you no longer need them.

Alternatively, when you start a new version of a file, rename the old one so that it begins with a given character, say an underscore. Then you can open the folder, sort by filename, and see all the old ones grouped together. This will make it easy to delete or move them.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
You can get a list of the files used in the project either using code like:

Code:
For Each loFile In _vfp.ActiveProject.Files
 ? loFile.Name
endfor

or with an SQL against pjx:
Code:
set deleted on
select name from myProject.pjx into cursor projectFiles nofilter
use in 'myProject'
select projectFiles
browse

Using Filer.dll you can also get the full tree of your project folder to compare those that are not part of the project.


Cetin Basoz
MS Foxpro MVP, MCP
 
Actually, instead of comparing and erasing I would programmatically create a new 'project backup' folder and copy all the files that are part of the project there with the same folder structure. This is especially important if like me you are having multiple projects in a single folder (finding out what to erase is harder than finding what not to).

Cetin Basoz
MS Foxpro MVP, MCP
 
I like that Cetin, the essense of original development - look at the problem from the other side.

Don't remove what you don't want, just copy what you do.


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top