Q. How can I improve the speed of a DIR command?

Jerold Schulman

November 7, 2006

1 Min Read
ITPro Today logo in a gray background | ITPro Today

If you have a folder that takes a long time to complete a DIR command, try using Log Parser instead. See tip 8970 Log Parser 2.2 is a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows® operating system such as the Event Log, the Registry, the file system, and Active Directory®.

NOTE: See the Log Parser 2.2 Documentation.

To perform the equivalent of a DIR on %SystemRoot%, use:

LogParser "SELECT Path, Name, Size FROM %systemroot%*.*" -recurse:0 -i:FS -o:NAT -rtp:-1

To perform the equivalent of a DIR /S on %SystemRoot%, use:

LogParser "SELECT Path, Name, Size FROM %systemroot%*.*" -i:FS -o:NAT -rtp:-1

The output of the above command might begin with:

Path                                              Name                                   Size------------------------------------------------- -------------------------------------- -------C:WINDOWS.                                      .                                      0C:WINDOWS..                                     ..                                     0C:WINDOWS$hf_mig$                               $hf_mig$                               0C:WINDOWS$MSI30UninstallMSI31-RC1$              $MSI30UninstallMSI31-RC1$              0. . . . . . .. . . . . . .C:WINDOWSAWSInstall.log                         AWSInstall.log                         616C:WINDOWSbasecsp.log                            basecsp.log                            3419C:WINDOWSBlue Lace 16.bmp                       Blue Lace 16.bmp                       1272C:WINDOWSBOOTSTAT.DAT                           BOOTSTAT.DAT                           2048. . . . . . .. . . . . . .C:WINDOWSINFwfp3.inf                           wfp3.inf                               3455C:WINDOWSINFwfp3.PNF                           wfp3.PNF                               8884. . . . . . .. . . . . . .


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like