![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 4
![]() |
Better Code
I'm writing a small app that's only task is to search for the windows prefetch folder and delete all that's in it. now this can be done by searching and just deleting the entire directory (it will re create itself) or you can search and then write a do...while loop to delete individual things within it. Which way is more acceptable/practical? or does is not matter?
|
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 380
Rep Power: 3
![]() |
It probably does not really matter; I would just delete the directory itself. The prefetch folder will just re-create itself, so there is no point in taking extra cycles to go in and delete the individual files.
__________________
I am Addicted to Linux! |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
|
cd /d %WINDIR%\Prefetch\ del /q *.*
__________________
Pain is just weakness leaving the body.
|
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 380
Rep Power: 3
![]() |
NightShade01, if you are writing this program to learn how do manage files then go for it, but if you are writing this to make things easier for yourself, I would probably do what AntiNinja posted.
__________________
I am Addicted to Linux! |
|
|
|
|
|
#5 |
|
Programmer
Join Date: Oct 2005
Posts: 52
Rep Power: 4
![]() |
I am writing this little app as part of a larger project however i know what AntiNinja is talking about (batch fiiling) and i can just incorporate that into my code. I was just wondering if one was better programming Etiquette
|
|
|
|
|
|
#6 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 380
Rep Power: 3
![]() |
As far as programming etiquette goes, they are both fine in this case. If the prefetch folder didn't regenerate automatically, it would be a bad idea to just delete the whole folder, but it does, so it would be more efficient programmatically to just delete the whole thing at once.
__________________
I am Addicted to Linux! |
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
It's generally a bad idea to nuke your Prefetch folder. Windows uses the folder to store information on program loading so the application will load faster the next time. You may be saving a miniscule amount of disk space, but you're wasting your own time by deleting the folder. With hard drive prices so damn low, there's really no reason to delete it.
|
|
|
|
|
|
#8 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 380
Rep Power: 3
![]() |
Ooble, I don't think it's that bad of an idea to delete the Prefetch folder once in a while. It gets filled with a bunch of crap, especially if you have changed what process get started on boot up. So deleting it once in a while and having windows regenerate it is a good idea because it cleans out a bunch of useless crap, and windows will put only what it needs back in. But you are right; doing this will save very little disk space and will probably have very little performance gain.
__________________
I am Addicted to Linux! |
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
My point is that it will have negative performance gain. You're right - some programs will not exist any more, or will be applications you don't use, but the majority will be very useful.
|
|
|
|
|
|
#10 |
|
Professional Programmer
Join Date: Jan 2006
Location: Ontario, Canada
Posts: 380
Rep Power: 3
![]() |
When Windows reboots and sees that it is not there, it will re-create it and put the nessisary files back in. So the first boot when it's not there will be slower, but after that it will be back up to speed, with a lot less crap in the folder.
__________________
I am Addicted to Linux! |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| EXECryptor software protection | Jean5 | C++ | 35 | Oct 10th, 2006 8:10 PM |
| Little help | whoawhoayoyo | Assembly | 8 | Apr 18th, 2006 8:10 PM |
| How to post a question | nnxion | C++ | 10 | Jun 3rd, 2005 12:53 PM |
| How to post a question | nnxion | C++ | 0 | Jun 3rd, 2005 9:55 AM |
| How to post a question | nnxion | C | 0 | Jun 3rd, 2005 9:55 AM |