How To Navigate, List Files and Directories In Windows Command Line With Dir

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-navigate-list-files-and-directories-in-windows-command-line-with-dir/
PINTEREST
PINTEREST
INSTAGRAM

Windows operating system provides command line tool named MS-DOS. This command line have different tools and capabilities for daily operations. We will look some simple steps about usage like navigation, list files and directories etc. We will mainly use dir command for this tutorial.

Help

Help information about dir command can be listed like below.

Help

Help

Change Drive

Windows operating systems generally uses drive names for different partitions or disks. Most common usage of drive is splitting disk into two part and setting their name as C: and D: . If we have a CD-ROM we will also have a drive named E: . Changin the command prompt path between these drives can be done by issuing drive names into command line.

In this example we will change drive to D: with the same command.

Or change drive to C: back again with command C:

Navigate Upper Directory

Windows file system NTFS uses hierarchical structure for storing directories and files. In order to access upper directories and files we need to change the command line path with cd .. command to the upper directory.

Navigate Upper Directory

Navigate Upper Directory

Navigate Selected Directory

Another mostly used navigation is changing command prompt directory into a child directory. We will use cd command with the directory name where we want to navigate. In this example we will navigate into directory named Users .

Navigate Selected Directory

Navigate Selected Directory

List Files and Folders

Current working directory files, folders and folders can be listed with the dir command. We will do not provide any parameter.

LEARN MORE  How To Use Fsutil To Check and Repair File System In Windows

List Files and Folders

List Files and Folders

This command listed all files and directories with their date time and type information.

List Only Directories

In previous command we have listed all files, folders and directories but how can we only list directories. We will provide directory attribute with /A:D option.

List Only Directories

List Only Directories

List Only Files

Another use case for dir command is listing only files. We will list only files with /A:-D option like below. This option actually negates so this will list non directories which is equal to files.

List Only Files

List Only Files

List Only Hidden Files

Hidden files are designed to be used by operating system. Users do not need these files to navigate, operate. This files generally holds cache or temporary values. We will use /A:H for list hidden files.

List Only Hidden Files

List Only Hidden Files

The hidden files listing output provides information like date time and files type like DIR and JUNCTION

Sort By Name While Listing

Sorting is very useful feature while looking specific directories and files. Files, folders and directories can be sorted with /O:N option like below.

Sort By Name While Listing

Sort By Name While Listing

Sort By Name While Listing In Reverse Order

We can list files, folders and directories alphabetically in reverse order. This start from z to sort. We will use /O:-N

Sort By Name While Listing In Reverse Order

Sort By Name While Listing In Reverse Order

Sort By Size While Listing From Smallest To Bigger

Files can be listed according to their sizes with the /O:S . This will start from smallest file and continue to bigger file.

LEARN MORE  How To Find and List Large Files and Directories In Linux?

Sort By Size While Listing From Smallest To Bigger

Sort By Size While Listing From Smallest To Bigger

Sort By Size While Listing From Bigger To Smallest

We can reverse the default sorting according to size. We will sort from bigger to the smallest with the /O:-S

Sort By Size While Listing From Bigger To Smallest

Sort By Size While Listing From Bigger To Smallest

Sort By Date By Listing

Files, folders and directories can be listed according to their creation date with the /O:D .

Sort By Date By Listing

Sort By Date By Listing

Display Owner Of The File

File, folders and directory owners can be listed and printed to the command line with /Q option.

Display Owner Of The File

Display Owner Of The File

In the output we will see the user and user domain or local system information.

Display Recursively

How can we list files, folders and folders deeper than current directory. We want to list all child file and folders and theirs childs up to end too. This is called recursive listing. We will use /S option to list all files and folder recursively.

Display Recursively

Display Recursively

Display Creation Time

Creation time of the files, folder and directories can be listed with the /T:C option like below.

Display Creation Time

Display Creation Time

Display Last Access Time

Last access time to the files, folder and directories can be /T:A option.

Display Last Access Time

Display Last Access Time

Display Last Written Time

Las written time shows what is the last change time of the file or directory. We will use /T:W

Display Last Written Time

Display Last Written Time

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/how-to-navigate-list-files-and-directories-in-windows-command-line-with-dir/
PINTEREST
PINTEREST
INSTAGRAM

You may also like...

Leave a Reply

Your email address will not be published.

Enjoy this blog? Please spread the word :)