Windows Dir Command Tutorial With Examples To List Files and File Information

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/windows-dir-command-tutorial-examples-list-files-file-information/
PINTEREST
PINTEREST
INSTAGRAM

Dir command is one of the most used Windows command. Dir is used mainly to list files and directories in Windows operating systems. In this tutorial we will look different usage examples of the dir command.

List Files and Folders

Without providing any option and parameter we will list all files and folder in the current working path. Current working path is the path where the shell currently locates. While printing files and folders there is also information like Volume name and Volume Serial Number.

List Files and Folders
List Files and Folders

List Files and Folders Bare Format

Bare format will only provide file and folders. There will be no other information like creation date time file type etc. We will provide the /b

List Files and Folders Bare Format
List Files and Folders Bare Format

List Files Recursively

The default behaivour is listing only current working directory. Listing sub directories is a need some times. This can be done with /s option like below.

List Files According To Extension

Another useful feature is listing files and directories with regular expression or similar glob presentation. One of the most used wanted situation is listing files and folders according to their extension. In this example we will list txt extension by using wildcard.

List Files According To Extension
List Files According To Extension

List JPEG Files

We can list jpeg files with the following command.

List Excel (xls) Files

We can list Excel files with the following command.

List Word (doc) Files

We can list Word files with the following command.

LEARN MORE  Windows Ren Command Tutorial with Examples To Rename Files and Folders

Attributes

Files and folder have attributes to provide information and store metadata about them. These attributes can be listed with dir command by providing related options. Some attributes file and folder may have are listed below;

  • Read
  • Write
  • Hidden
  • Directory

List Only Directories

We may need to print only directories and do not include files. This can be done with the display only directory attribute like below.

List Only Directories
List Only Directories

List Only Files

We will use directory attribute but we will negate the attribute and this will only display the non directory files. We will use /A:-D option .

List Only Files
List Only Files

List Read Only Files

In windows systems files can be read, write, append etc. To protect files for changes some files are made read only. These files can be listed by using read only attributes with /A:R

List Hidden Files

Hidden files can be listed with the /A:H option.

Exclude Read Only Files

Read only files can be excluded by negating the normal usage like below.

Excludes System Files

Windows have system files those have tagged as system file as attribute. We can exclude system files while listing with /A:-S

Print Detailed Metadata For Files

Meta data about files and folder can be printed with /Q option. This will also list file ownership.

Print Detailed Metadata For Files
Print Detailed Metadata For Files

List Created Time

The file creation time can be listed with the /TC option.

List Created Time
List Created Time

List Last Accessed Time

Files are accessed during time these access time can be printed with the /TA option like below.

LEARN MORE  About Plugins Of Chrome

List Last Accessed Time
List Last Accessed Time

Find Last Modified Time

Last modified time of the file can be listed with the /TW option.

Find Last Modified Time
Find Last Modified Time
RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/windows-dir-command-tutorial-examples-list-files-file-information/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.