@echo off REM Stat.cmd -- NT Batch file to provide similar info to UNIX (file) stat. REM v1.0 03-Dec-2000 JPV REM Only runs under NT command shell "cmd.exe", not under Win9x "command.com"! REM Needs the following FREE (GNU GPL 2.x) program: rem vdate.exe (http://home.flash.net/~dtribble/dos/vdate.exe) if "%1" == "" goto :Usage cls echo. set MyName=%~nx0 echo %MyName%: Getting File Info for %1 echo. rem Use special "set" commands to parse out name and path info set FilePath=%~f1 echo Path = %FilePath% set FileName=%~nx1 echo Name = %FileName% set FilePth=%~p1 echo Pth = %FilePth% set FileDrv=%~d1 echo Drv = %FileDrv% set FileNm=%~n1 echo Nm = %FileNm% set FileExt=%~x1 echo Ext = %FileExt% echo. echo All together: %FileDrv% %FilePth% %FileNm% %FileExt% or echo %FileDrv%%FilePth%%FileNm%%FileExt% echo. for /f %%x in (' dir %FilePath% ^| find /i "%FileName%" ') do set FileDate=%%x echo Date = %FileDate% for /f "tokens=2" %%x in (' dir %FilePath% ^| find /i "%FileName%" ') do set FileTime=%%x echo Time = %FileTime% for /f "tokens=3" %%x in (' dir %FilePath% ^| find /i "%FileName%" ') do set FileSize=%%x echo Size = %FileSize% REM Remove the commas from file size. We could have used dir /-C switch, but this is more fun. set FileSize=%FileSize:,=% echo Size = %FileSize% (no comma(s)) echo. if %FileSize% GTR 1457663 echo %1 Will NOT fit on a floppy!!! if %FileSize% LSS 1457663 echo %1 WILL fit on a floppy!!! echo. rem Use vdate to rename by date. See "vdate --help" for TONS of formatting options! echo Using 'vdate', we can rename like this: for /f "tokens=1" %%x in ('vdate +%%Y%%m%%d') do echo ren %1 %%x.%1 echo. REM The UNIX code for the DOS mess for the date rename above is: rem echo Using date we can rename like this: mv $1 `date +%%Y%%m%%d`.$1 REM Clean up our (environment) varables set MyName= set FilePath= set FilePth= set FileDrv= set FileName= set FileNm= set FileExt= set FileDate= set FileTime= set FileSize= goto :EOF :Usage echo. echo Usage: %0 {filespec} echo.