Originally posted by Sororal at 2006-11-16 22:21:
Thanks to brother 0451lym!
Didn't find DIRT.COM,
Can you send one? Sororal@21cn.com
Thanks!
DIRT usage instructions are as follows:
Dirt.COM FileName.Ext (Ver 1.15)
(|)] HH:MM:SS]
Note: The function of setting environment variables of this program cannot run normally in the following systems.
winXP, win2000, and any system virtualized in Virtual PC
Whether or not a file that meets the conditions is found, Dirt.COM will set the environment variable DirtRet when exiting: Fail means no file is found, and Success means a file is found.
=====================================================
Ver 1.15
Update date: 2005-11-07
Upgrade instructions:
(1) Correct the error in the previous version where it directly searched from the root directory when "without path and file name" was searched.
(2) Add the automatic date calculation function to the original parameter YYYY-MM-DD].
Example:
Rem Find all files modified yesterday
dirt *.* /d:(-2)
In the last relatively long example, because the function of "automatic date calculation" has been added now, it can be simplified as follows:
@echo off
rem ============================================
rem The function of this batch processing is to delete all files (including files in all subdirectories) in d:\datafile that were last modified 7 days ago (excluding 7 days)
rem ============================================
attrib/s d:\datafile\*.* -h -r -s
:Loop
dirt.com /d:-(-7) d:\datafile\*.* /q
if %DirtRet%==Fail goto end
del %FPath%\%FName%
goto Loop
:end
=====================================================
Ver 1.14
Update date: 2005-10-29
Upgrade instructions:
(1) Correct the error that no file was found when searching in the root directory in the previous version.
(2) Add the function of returning code exit to the function of .
In this way, this function can be used in 2000 or xp. If the directory exists, return 1,
If it does not exist, return 0.
Example:
Judge whether d:\aa exists. If it does not exist, create it and enter
@echo off
dirt /dir:d:\aa
if errorlevel 1 goto exist
echo make d:\aa
md d:\aa
:exist
cd d:\aa
=====================================================
Ver 1.13
Update date: 2005-10-14
Upgrade instructions:
(1) Correct the wrong analysis of "*.*" in the previous version.
(2) Add parameter
Save the first 10 found files in the following environment variables
O2E_DriverX, O2E_PathX, O2E_FNameX
Save the drive letter, path, and file name respectively, where the last X is the serial number,
Replaced by 0 to 9. If the searched is a directory, O2E_FNameX will not be set
(3) Add parameter
Among the found files or directories, find the one with the earliest or latest time,
And save it in the following environment variables, FPath, FName
furthest is to find the file or directory with the earliest time
latest is the opposite
(4) Add parameter
The length of the main environment variable list of the Dos system is limited, so learn to clean up garbage.
This function is to clear all environment variables generated by this program.
(Note: The environment variables generated by this program cannot be cleared or modified by the Dos Set command
Because the Set command does not support variable names with lowercase letters)
Example:
rem Find the file with the latest modification time under D: and display it
dirt d:\*.* /time:latest
echo %FPath%\%FName%
rem Find the directory with the earliest creation time under D: and display it
dirt d:\*.*\ /time:furthest
echo %FPath%
=====================================================
Ver 1.12
Update date: 2005-09-22
Upgrade instructions:
(1) Correct some errors in "search path analysis".
(2) Add the function of folder search. Support all parameters except
But it finds the "creation time" of the directory. It is different from finding files (finding files is
According to the "modification time" of the file), so when the directory is renamed, its creation time
Will not change.
In the quick mode , the full path including the folder to be searched will be written into the environment variable FPath, and FName will not be set
The usage is: add a slash at the end of the path, and the specific method is as follows
Example:
dirt d:\ghost8\ /q
Search for a folder named "ghost8" under drive D. If found, enter it
@echo off
rem Note that there must be \ after ghost8
rem Otherwise, it will become searching for files
dirt d:\ghost8\ /q
if == goto notexist
cd %FPath%
goto end
:notexist
echo No such directory found
:end
=====================================================
Ver 1.11
Update date: 2005-09-18
New function introduction:
Judge whether a certain folder exists, and set the environment variable Dir: Exist means exists,
NotExist means does not exist
Example:
Judge whether d:\aa exists. If it does not exist, create it and enter
@echo off
dirt /dir:d:\aa
if == goto exist
md d:\aa
:exist
cd d:\aa
=====================================================
Ver 1.1
New function introduction:
Whether or not a file that meets the conditions is found, Dirt.COM will set the environment variable DirtRet when exiting: Fail means no file is found, and Success means a file is found.
In this version, the error that the parameter position cannot be changed arbitrarily in version 1.0 is also corrected.
The function is the same as the /w of the dir command, and 5 file names are displayed per line.
Enable quick mode. As long as one file that meets the conditions is found, the search will end immediately.
And the file path and file name will be written into the environment variables FPath and FName respectively.
In addition, this program is now compiled into a.com file, and its volume is half smaller than the original dirt.exe.
=====================================================
Example:
Find the Tc.exe file in drive D. If found, run it directly and open the file try.c in the root directory of drive D. If not found, display a prompt message.
@echo off
Dirt d:\tc.exe /Q
if %DirtRet%==Fail goto NoFind
d:
cd %fpath%
%fname% d:\try.c
goto quit
:NoFind
echo.
echo.
echo Tc.exe not found in drive D
:quit
=====================================================
Function of Ver 1.0:
YYYY-MM-DD]
Specify the date, it must be of sufficient length, for example:
/d:2004-05-01 cannot be written as /d:2004-5-1
The inside is only later or earlier than this date
Such as: /d:-2004-05-01 Search for files before 2004-05-01
HH:MM:SS]
Reference date format
Time and date can be used together
The maximum number of layers of subdirectories to search, the maximum is two digits (that is, 99),
/L:0 does not search subdirectories
The default is all layers
====================================================
Another example:
@echo off
rem ============================================
rem The function of this batch processing is to delete all files (including files in all subdirectories) in d:\datafile that were last modified 7 days ago (excluding 7 days)
rem ============================================
rem ============================================
rem Get the date 7 days ago
rem If today is August 25, the date 7 days ago is August 18
rem ============================================
GetInfo.COM /d:-7
set theDay=%year%-%mon%-%day%
rem ============================================
rem This is to search for files modified 8 days ago (including 8 days) in D:\datafile
rem That is, files modified on August 17 and before
rem ============================================
attrib/s d:\datafile\*.* -h -r -s
:Loop
dirt.com /d:-%theDay% d:\datafile\*.* /q
if %DirtRet%==Fail goto end
del %FPath%\%FName%
goto Loop
:end