Saturday, 22 June 2019

Batch: dir: print list of files and directories


‘dir’ command displays the list of files and directories in current directory.

Open command prompt and execute ‘dir’ command.

C:\Users\Public\databases>dir
 Volume in drive C is OSDisk
 Volume Serial Number is 1034-4F6F

 Directory of C:\Users\Public\databases

08/07/2018  09:28 PM    <DIR>          .
08/07/2018  09:28 PM    <DIR>          ..
08/07/2018  09:28 PM    <DIR>          batch script tutorial
02/10/2017  09:17 AM               436 customerDb.properties
02/10/2017  09:17 AM        52,887,096 customerDb.script
08/07/2018  09:28 PM    <DIR>          testApp
               2 File(s)     52,887,532 bytes
               4 Dir(s)  38,256,885,760 bytes free


As you see the above image, you can get below information from dir command.
a.   Displays the current directory absolute path
b.   . represents current directory
c.    .. represents parent directory
d.   There are 4 directories and 2 files presented in current directory.
e.   It displays file and directory names


Previous                                                 Next                                                 Home

No comments:

Post a Comment