-->
How To Purpose The Dir Ascendance Inwards Windows

How To Purpose The Dir Ascendance Inwards Windows

How To Purpose The Dir Ascendance Inwards Windows

https://www.howtogeek.com/363639/how-to-use-the-dir-command-in-windows/

The DIR dominance is a powerful Windows Command Prompt constituent that lists all files in addition to subdirectories contained inward a specific directory. The DIR dominance also offers some switches that unlock some powerful functionality. Let's direct maintain a look.

DIR Command Switches

You tin utilization the DIR command yesteryear itself (just type "dir" at the Command Prompt) to listing the files in addition to folders inward the electrical current directory. To extend that functionality, you lot postulate to utilization the diverse switches, or options, associated amongst the command.

Display Based on File Attributes

You tin add together "/A" followed yesteryear a missive of the alphabet code after the DIR dominance to display files amongst a specific attribute. These missive of the alphabet codes include:

  • D: Displays all directories inward the electrical current path
  • R: Displays read-only files
  • H: Displays hidden files
  • A: Files that are cook for archiving
  • S: System files
  • I: Not content indexed files
  • L: Reparse points

So, for example, to display only the directories inward the electrical current path, you'd type the next dominance in addition to and thence hitting Enter:

dir /ad

You tin combine those codes, too. For example, if you lot wanted to demonstrate only organisation files that are also hidden, you lot could utilization the next command:

dir /ash

You also tin add together a "-" (minus) inward front end of whatsoever of those missive of the alphabet codes to specify that the DIR dominance does non demonstrate that form of file. So, for example, if you lot don't desire to meet whatsoever directories inward the results, you lot could utilization this command:

dir /a-d

One to a greater extent than tip: Instead of cramming the principal switch in addition to the missive of the alphabet code together the way nosotros did inward our examples, you lot tin utilization a colon to split the switch from its optional codes. Like this:

dir /a:d

It tin brand things a piddling easier to parse, but it's only optional.

Display Stripped Results

The DIR dominance is a powerful Windows Command Prompt constituent that lists all files in addition to sub How to Use the DIR Command inward Windows

Using the /b switch amongst the DIR dominance strips away all excess information, displaying only the get upwards of the folders in addition to files inward the electrical current directory in addition to non attributes similar file size in addition to fourth dimension stamps. Type the next dominance to larn far work:

dir /b

Display Using Thousands Separator

In modern versions of Windows, the Command Prompt shows large numbers separated yesteryear commas (so: 25,000 instead of 25000). This wasn't ever the case. In older versions, you lot had to utilization the /c switch to demonstrate those commas.

Why bother including it hither if it's already the default? Because if for whatever argue you don't want to demonstrate those commas, you lot tin utilization this switch along amongst the "-" minus sign:

dir /-c

 

Display Results inward Columns

The DIR dominance is a powerful Windows Command Prompt constituent that lists all files in addition to sub How to Use the DIR Command inward Windows

You tin utilization the /D switch to display results inward 2 columns instead of one. When you lot display results this way, the Command Prompt does non demonstrate extra file information (file size in addition to thence on)—just the names of the files in addition to directories.

dir /D

Display Results inward Lowercase

The /L switch displays all names of files in addition to folders every bit lowercase.

dir /L

Display Filename Results on the Far Right

The DIR dominance is a powerful Windows Command Prompt constituent that lists all files in addition to sub How to Use the DIR Command inward Windows

By default, the Command Prompt displays the names of files to the far right. The /N switch used to endure used to give this effect. Now, you lot tin utilization it along amongst a "-" (minus) to direct maintain filenames displayed on the far left instead.

dir /-N

Display Results inward Sorted Order

You tin utilization the /O switch followed yesteryear a missive of the alphabet code to display directory results sorted inward diverse ways. Those missive of the alphabet codes include:

  • D: Sorts yesteryear date/time. Older entries appear first.
  • E: Sorts yesteryear file extension inward alphabetical order.
  • G: Sorts yesteryear listing folders first, in addition to thence files.
  • N: Sorts yesteryear the get upwards of file/folder inward alphabetical order.
  • S: Sorts yesteryear file size, smallest to largest.

So, for example, you lot could utilization the next dominance to sort results yesteryear fourth dimension in addition to date, amongst older entries appearing first:

dir /OD

You tin also add together "-" (minus) earlier whatsoever of the higher upwards options to contrary the order. So, for example, if you lot desire to sort files yesteryear fourth dimension in addition to appointment amongst newer entries appearing first, you lot could utilization this command:

dir /O-D

Display Results One Page at a Time

The DIR dominance is a powerful Windows Command Prompt constituent that lists all files in addition to sub How to Use the DIR Command inward Windows

Some directories direct maintain hundreds or thousands of files. You tin utilization the /P switch to direct maintain the Command Prompt suspension the results after it displays each screen. You direct maintain to press a cardinal to decease along viewing the side yesteryear side page of results.

dir /P

Display Metadata

The DIR dominance is a powerful Windows Command Prompt constituent that lists all files in addition to sub How to Use the DIR Command inward Windows

Using the /Q switch on the DIR dominance displays metadata tied to files in addition to directories, along amongst ownership details.

dir /Q

Display Alternate Data Streams (ADS)

The /R switch displays whatsoever alternate information streams (ADS) that files mightiness contain. ADS are a characteristic of the NTFS file organisation that allow files incorporate additional metadata for locating files yesteryear writer in addition to title.

dir /R

Display All Files in addition to Folders in addition to Everything Inside

You tin utilization the /S switch to recursively demonstrate all files in addition to folders within the electrical current directory. This agency all files in addition to folders inward every subdirectory, all files in addition to folders inward those subdirectories, in addition to thence on. Be prepared for a lot of results.

dir /S

Display Results Sorted yesteryear Time

Using the /T switch along amongst a missive of the alphabet code lets you lot sort results yesteryear the dissimilar fourth dimension stamps associated amongst files in addition to folders. These missive of the alphabet codes include:

  • A: The fourth dimension the item was final accessed.
  • C: The fourth dimension the item was created.
  • W: The fourth dimension the item was final written to. This is the default pick used.

So, for example, to sort results yesteryear the fourth dimension items were created, you lot could utilization the next command:

dir /TC

Display Results inward Wide Format

The /W switch is similar to /D (which shows columns), but instead, it sorts the results inward broad format horizontally.

dir /W

Display Short Name Filenames

The /X switch shows a file's curt get upwards when the long get upwards doesn't comply amongst 8.3 naming rules.

dir /X

 

Display Help Pages For DIR

Using the /? switch displays helpful information regarding the DIR command, including a brief description of all the switches we've talked about.

DIR Command Examples

All right, immediately you lot know close the switches in addition to options associated amongst the DIR command. Let's direct maintain a await at a few real-world examples to gain a amend agreement every bit to how you lot tin start putting them to use.

A simple dir command returns a listing of all files in addition to folders inward the electrical current directory you're in.

Running the next command shows all organisation files within your electrical current path yesteryear utilizing the "s" attribute:

dir /a:s

But what if you lot desire to persuasion all files of a for certain type within all subsequent folders of your electrical current path. That's easy, only run this extremely fast in addition to useful command:

dir \*.mp3 /s

You tin supersede the ".mp3" constituent amongst whatever file format you're looking for.

The asterisk acts every bit a wildcard, maxim "find anything amongst .mp3 file format at the end" spell the "/s" recursively looks through all folders within your electrical current path.

RELATED: This Command Prompt Trick Searches Way Faster Than Windows Explorer

Now, you lot may direct maintain noticed that returned a LOT of results. Almost also many to endure able to read earlier they scrolled off the screen. This is where nosotros tin utilization the pause switch to give you lot a direct chances to read them. To create that, modify the dominance similar this:

dir \*.mp3 /s /p

Another play a joke on the Command Prompt offers is called piping. You tin utilization the ">" graphic symbol to ship the results of 1 dominance to some other house or service. Influenza A virus subtype H5N1 proficient illustration of this is sending all your results to a text file. You tin in addition to thence scroll through them afterward or import them into other types of documents. To create that, you lot could utilization the command:

dir \*.mp3 /s /b > filename.txt

RELATED: How to Print or Save a Directory Listing to a File inward Windows

We added the /b switch inward in that place to only output the filenames themselves, without whatsoever of the other details. The greater than symbol reroutes everything commonly displayed inward your results straight to the file.


There are many to a greater extent than combinations in addition to uses for the DIR command, but this should endure a proficient starting signal to assist you lot sympathise the basics.

Blogger
Disqus
Pilih Sistem Komentar

No comments

Advertiser