Discussion Locked

DOS

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Hi,
I have a winnt4.0 platform.Practically all my clients are win95 & win98.They all run the same application on there computer and create alot of temp files all in the same directory name on their computer.I was wondering on how I could limit the amount of files in that directory.Is there a way maybe through a batch file that I keep a certain amount in their directory instead of letting it build up.I'm not very good at writing batch files.Any help would be appreciated.Thank's in advance..

3 replies

by beermonster

I think the simplest way to do this is to have either a login script or a local startup script that clears the directory every time a user logs on. If the files have a .tmp extension for example, the script would simply say

del c:\mydirectory\*.tmp /Q
where /q suppresses prompts for confirmation. If there are various file extentions involved, and no common naming convention between the files to search on, then add a line for each type of file. if you want to clear the directory totally, use
del c:\mydirectory\*.* /Q

by paul d. masley

This is a simple batch program that I wrote that you can use or insert in the Autoexec.bat.

@echo off
cls
@SET TEMP=C:\WINDOWS\TEMP
@SET TMP=C:\WINDOWS\TEMP

@DelTree /Y C:\WINDOWS\Temp
@echo off
@MD C:\WINDOWS\Temp

cls

This will completely remove the "Temp" file and then make another. Lines 5, 6, and 7 is what you want to use. The /Y after deltree answers the question of Deltree without user intervention. You can also use this by changing the directories and deleting any other folders. Just make sure you change both lines 5 and 7 to match. Example follows:

@DelTree /Y ?:\123456
@echo off
cls
@MD ?:\123456

Where ? is the harddrive letter and \123456 is the folder.

You can also use del as follows in the autoexec.bat file.

del c:\windows\temp\*.txt
del c:\windows\\temp\*.bak

You can add as many as you want.

Actually it is better for WIN95/98 clients to start out each day with the "Temp" folder empty. All it does is take up space.

Hope this helps!

Paul.

by msfiroudis

I do appreciate the response but for instance is there any way to keep the most recent dates of files and delete all the rest...In that one particular library.... In othere words can I delete a date range....

This discussion is closed to new replies.