DelOld—delete old files

Tue, 2008-04-08 15:56 by admin · Forum/category:

General information

DelOld is a program that deletes files that are older than a specified number of days. DelOld is called from a command line and requires at least two arguments, the folder and possibly file name (can contain the wildcard characters * and ?) and the minimum age of the files to be deleted.

DelOld is freeware.

DelOld does not require installation. Just copy the executable program file onto your hard disk.

See also Microsoft's addition to some resource kits and to Windows Server 2003 of a similar command line tool: ForFiles. Read a description with sample batch files here.

Version 2 instructions for use

DelOld 2 has been rewritten in Java and has improved window display behavior and should run on all platforms that support Java. It requires the Java SE Runtime Environment (JRE) version 5 or higher, which you have to download and install.

The Java version consists only of one executable Java file: DelOld.jar

If there experience any problems with the DelOld.jar file on Windows, which happens only if the Java SE Runtime Environment is damaged or not installed, you can download the somewhat bigger DelOld.exe instead. This variant will direct you to the Java SE Runtime Environment download if it is not already installed.

In the command line you have to enter at least two parameters:

  1. The file path in which old files are to be deleted.

    The path can be absolute with or without a drive letter or relative to the current folder. It can end in a file name, which may include the wildcard characters ? and *.

    Examples:

    C:\TEMP

    C:\TEMP\

    temp

    temp\*.log

    \TEMP\datalog.*

    If the path contains spaces, enclose it in quotes.

    Example (1 line):

    "C:\Documents and Settings\All Users\Application Data\Log files"

    This argument can appear more than once, i.e. you can enter multiple, different paths.

  2. The number of days before a file will be deleted.

    This always has to be the last argument in the command line.

Examples for proper DelOld calls:

DelOld.jar C:\TEMP 60

DelOld.exe \TEMP\*.tmp 1

DelOld.jar D:\Users\Mike\Garbage 33

DelOld.jar "C:\TEMP\User Logs\" 8

DelOld.exe \TEMP 3

DelOld.jar C:\TEMP D:\TEMP 14

You can call the program from a Program Manager icon. In this case put the complete call line including the two parameters into the call command line. You can also put the icon into your Startup group for automatic operation.

In Windows NT, 2000, and XP you can start it from a batch file.

Examples:

start /low /wait DelOld.jar C:\TEMP\ 1

start /low /wait DelOld.exe C:\TEMP D:\TEMP 7

start /low /wait DelOld.jar "C:\Users\DJ\My Documents\Throw away\" 66

start /low /wait DelOld.jar "C:\TEMP\User Logs\*.log" 8

DelOld will display what it has done. It will stay on screen briefly after finishing its work plus some more seconds for each file actually deleted, so you can quickly get a glimpse of what it has done. Then it will close itself automatically.

If you want to stop it before it deletes any files, click on the [Pause] button. You can then either click on the [Continue] button to have the files deleted or on the [Abort] button to abort the program and keep the files. Note that you have only between 4 and 8 seconds, depending on the number of files (1 file: 4 seconds, 9 or more files: 8 seconds).

If the same file appears in more than one folder argument, it will be listed multiple times, but it will still be deleted without error message.

If you cannot start a JAR file directly in spite of Java version 5 or higher being installed, then the Java installation is damaged. You have the following ways to proceed.

  1. Reinstall the Java SE Runtime Environment (JRE).
  2. Precede the command line with:

    javaw -jar

    or with:

    java -jar

    Example (1 line):

    java -jar delold.jar "C:\TEMP\Log files" 30

  3. Repair the association of JAR files in Windows.
    • Open Windows Explorer
    • Click on the commands: Tools, Folder Options, File Types
    • Search for: JAR
    • If JAR is not in the list, click on the [New] button and enter it. Click on the [Advanced>>] button and link it to the file type: Executable Jar File
    • If JAR is in the list, check its settings. The procedure is too complicated to explain here, but you may have success with removing the file type JAR and recreating it as explained above. If this fails, use one of the above methods.

Version 1 instructions for use

DelOld will not automatically operate on subdirectories, only on the directory you specify. But of course you can call DelOld several times with several directories, file names and file ages.

DelOld 1 requires MSVBVM60.DLL (1.34 MB) however, which you can download from the World Wide Web after searching for the file name.

In Windows 95 copy MSVBVM60.DLL into the SYSTEM subdirectory. In Windows NT, 2000, and XP copy it into the SYSTEM32 subdirectory.

The distribution packet for DelOld 1, deloldx.exe, contains the following files.

DelOld.vbp (Visual Basic source)

DelOld.frm (Visual Basic source)

DelOld.frx (Visual Basic source)

DelOld.bas (Visual Basic source)

DelOld.txt (these instructions for use)

DelOld.exe (executable program)

If you want to modify the program, have a look at DelOld.vbp first. It's a text file. Some paths might be different on your computer.

In the command line you have to enter two parameters:

  1. The file path in which old files are to be deleted, including the
    file name or file name wildcards complete with drive letter.
    Example: C:\TEMP\*.*

    If the path contains spaces, enclose it in quotes.
    Example: "C:\Documents and Settings\All Users\Application Data\X\*.*"

  2. The number of days before a file will be deleted.

Examples for proper DELOLD calls:

DELOLD.EXE C:\TEMP\*.* 60

DELOLD C:\TEMP\*.TMP 1

DELOLD C:\TEMP\~*.* 2

DELOLD D:\USERS\MIKE\GARBAGE\*.* 33

DELOLD "C:\TEMP\User Logs\*.log" 8

You can call the program from a Program Manager icon. In this case put the complete call line including the two parameters into the call command line. You can also put the icon into your Startup group for automatic operation.

In newer versions of Windows you can start it from a batch file. The following examples presume that the program is somewhere in the operating system's search path. If this is not the case, you have to prefix DelOld with its path:

start /low /wait DelOld C:\TEMP\*.TMP 1

start /low /wait DelOld C:\TEMP\~*.* 1

start /low /wait DelOld C:\TEMP\*.* 66

start /low /wait DelOld "C:\TEMP\User Logs\*.log" 8

DelOld will display what it has done. It will stay on screen briefly after finishing its work plus some more seconds for each file actually deleted, so you can quickly get a glimpse of what it has done. Then it will close itself automatically.

Downloads

AttachmentSize
Version 2.1, pure Java for all platforms including Windows - DelOld.jar5.65 KB
Version 2.1, Java Windows EXE alternative - DelOld.exe32.65 KB
Version 1, Visual Basic 6, requires MSVBVM60.DLL runtime module - deloldx.exe27.65 KB

DelOld Not Work if the path or file name contain spaces.

Mon, 2010-07-05 06:53 by pkengaba2

I found it out that DelOld won't work if the path or the file name has spaces.

Example is if the path to the files are like
c:\My Document\ or c:\Program Files\

Suggestion in this forum said that to overcome that error, put double quotes between the path like

DelOld "C\:My Document\*.*" 8

However, with the above I note that dos still can't read the path.

The error I received is give is:
"The number of days given in the second command line parameter was found to be 0. However, it has to be a possitive number of days. Aborting."

Can Anyone help me why the double quotes does not work please?

Paul

Which version?

Mon, 2010-07-05 20:31 by admin

Which version did you try? Superficial testing shows that at least the Java versions have the problem.

You can use ForFiles instead, which is mentioned at the top. Since ForFiles is a free program that fulfills the same purpose, I will probably not update DelOld. But if anybody else wants to, the source code is available.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.