dir 列出文件清单

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

Dir命令是最常用的Windows命令之一。 Dir主要用于列出Windows操作系统中的文件和目录。 在本教程中,我们将查看dir命令的不同用法示例。

列出文件和文件夹 (List Files and Folders)

Without providing any option and parameter we will list all files and folders in the current working path. The 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.

在不提供任何选项和参数的情况下,我们将列出当前工作路径中的所有文件和文件夹。 当前工作路径是外壳当前所在的路径。 在打印文件和文件夹时,还有诸如卷名和卷序列号之类的信息。

$ dir

List Files and Folders
列出文件和文件夹

列出文件和文件夹的裸格式(List Files and Folders Bare Format)

The bare format will only provide files and folders. There will be no other information like creation date-time file type etc. We will provide the /b option.

裸格式将仅提供文件和文件夹。 将没有其他信息,例如创建日期时间文件类型等。我们将提供/b选项。

$ dir /b

List Files and Folders Bare Format
列出文件和文件夹的裸格式

递归列出文件(List Files Recursively)

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

默认行为是仅列出当前工作目录。 列出子目录有时是需要的。 可以使用/s选项(如下所示)完成此操作。

$ dir /s

根据扩展名列出文件 (List Files According To Extension)

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

另一个有用的功能是使用正则表达式或类似的glob表示形式列出文件和目录。 最常用的通缉情况之一是根据文件和文件夹的扩展名列出它们。 在此示例中,我们将使用通配符列出txt扩展名。

$ dir *.txt

List Files According To Extension
根据扩展名列出文件

列出JPEG文件(List JPEG Files)

We can list jpeg files with the following command.

我们可以使用以下命令列出jpeg文件。

$ dir *.jpeg

列出Excel(xls)文件 (List Excel (xls) Files)

We can list Excel files with the following command.

我们可以使用以下命令列出Excel文件。

$ dir *.xls

列出Word(doc)文件 (List Word (doc) Files)

We can list Word files with the following command.

我们可以使用以下命令列出Word文件。

$ dir *.doc

文件和文件夹属性 (File and Folder 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;

文件和文件夹具有提供信息并存储有关它们的元数据的属性。 通过提供相关选项,可以使用dir命令列出这些属性。 下面列出了一些属性文件和文件夹:

  • Read读
  • Write写
  • Hidden隐
  • Directory目录
  • ……
.ub667cdf5ddc9f18f58d5a49c447a7722 , .ub667cdf5ddc9f18f58d5a49c447a7722 .postImageUrl , .ub667cdf5ddc9f18f58d5a49c447a7722 .centered-text-area { min-height: 80px; position: relative; } .ub667cdf5ddc9f18f58d5a49c447a7722 , .ub667cdf5ddc9f18f58d5a49c447a7722:hover , .ub667cdf5ddc9f18f58d5a49c447a7722:visited , .ub667cdf5ddc9f18f58d5a49c447a7722:active { border:0!important; } .ub667cdf5ddc9f18f58d5a49c447a7722 .clearfix:after { content: ""; display: table; clear: both; } .ub667cdf5ddc9f18f58d5a49c447a7722 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .ub667cdf5ddc9f18f58d5a49c447a7722:active , .ub667cdf5ddc9f18f58d5a49c447a7722:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .ub667cdf5ddc9f18f58d5a49c447a7722 .centered-text-area { width: 100%; position: relative; } .ub667cdf5ddc9f18f58d5a49c447a7722 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .ub667cdf5ddc9f18f58d5a49c447a7722 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .ub667cdf5ddc9f18f58d5a49c447a7722 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .ub667cdf5ddc9f18f58d5a49c447a7722:hover .ctaButton { background-color: #E67E22!important; } .ub667cdf5ddc9f18f58d5a49c447a7722 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .ub667cdf5ddc9f18f58d5a49c447a7722 .ub667cdf5ddc9f18f58d5a49c447a7722-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .ub667cdf5ddc9f18f58d5a49c447a7722:after { content: ""; display: block; clear: both; }

LEARN MORE  How To Linux Bash For Loop In Files?

.ub667cdf5ddc9f18f58d5a49c447a7722 , .ub667cdf5ddc9f18f58d5a49c447a7722 .postImageUrl , .ub667cdf5ddc9f18f58d5a49c447a7722 .centered-text-area { min-height: 80px; position: relative; } .ub667cdf5ddc9f18f58d5a49c447a7722 , .ub667cdf5ddc9f18f58d5a49c447a7722:hover , .ub667cdf5ddc9f18f58d5a49c447a7722:visited , .ub667cdf5ddc9f18f58d5a49c447a7722:active { border:0!important; } .ub667cdf5ddc9f18f58d5a49c447a7722 .clearfix:after { content: ""; display: table; clear: both; } .ub667cdf5ddc9f18f58d5a49c447a7722 { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .ub667cdf5ddc9f18f58d5a49c447a7722:active , .ub667cdf5ddc9f18f58d5a49c447a7722:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .ub667cdf5ddc9f18f58d5a49c447a7722 .centered-text-area { width: 100%; position: relative; } .ub667cdf5ddc9f18f58d5a49c447a7722 .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .ub667cdf5ddc9f18f58d5a49c447a7722 .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .ub667cdf5ddc9f18f58d5a49c447a7722 .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .ub667cdf5ddc9f18f58d5a49c447a7722:hover .ctaButton { background-color: #E67E22!important; } .ub667cdf5ddc9f18f58d5a49c447a7722 .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .ub667cdf5ddc9f18f58d5a49c447a7722 .ub667cdf5ddc9f18f58d5a49c447a7722-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .ub667cdf5ddc9f18f58d5a49c447a7722:after { content: ""; display: block; clear: both; }

了解更多信息如何在Linux Bash中循环文件?

仅列出目录 (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.

我们可能只需要打印目录而不包含文件。 这可以通过如下所示的“仅显示目录”属性来完成。

$ dir /A:D

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 .

我们将使用目录属性,但是将使属性无效,这将仅显示非目录文件。 我们将使用/A:-D选项。

$ dir /A:-D

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.

在Windows系统中,可以读取,写入,追加等文件。为了保护文件不被更改,某些文件被设为只读。 可以通过对/A:R使用只读属性来列出这些文件。

$ dir /A:R

列出隐藏文件 (List Hidden Files)

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

可以使用/A:H选项列出隐藏的文件。

$dir /A:H

排除只读文件 (Exclude Read Only Files)

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

通过取消如下所示的常规用法,可以排除只读文件。

$ dir /A:-R

排除系统文件 (Excludes System Files)

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

Windows具有标记为系统文件作为属性的系统文件。 当使用/A:-S列出时,我们可以排除系统文件。

$ dir /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.

可以使用/Q选项打印有关文件和文件夹的元数据。 这还将列出文件所有权。

$ dir /Q

Print Detailed Metadata For Files
打印文件的详细元数据

列出文件和文件夹的创建时间(List Create Time of Files and Folders)

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

可以使用/TC选项列出文件创建时间。

$ dir /TC

List Created Time
列出创建时间

列出上次访问时间(List Last Accessed Time)

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

在访问期间,可以使用/ TA选项打印这些访问时间,如下所示。

$ dir /TA

List Last Accessed Time
列出上次访问时间

查找上次修改时间(Find Last Modified Time)

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

文件的上次修改时间可以使用/ TW选项列出。

$ dir /TW

Find Last Modified Time
查找上次修改时间

翻译自: https://www.poftut.com/windows-dir-command-tutorial-examples-list-files-file-information/

dir 列出文件清单

dir 列出文件清单_Windows Dir命令教程,以列出文件和文件信息的示例相关推荐

  1. ren指令重命名文件夹_Windows Ren命令教程,其中包含重命名文件和文件夹的示例...

    ren指令重命名文件夹 Windows ren command is used to rename files and folder. ren command provides command lin ...

  2. ubuntu 将某个目录下的文件复制到_命令行 将多个特定文件从一个文件夹复制到另一个文件夹...

    只需从命令行一次复制多个文件 有几种方法可以实现这个,我见过的最容易的是cp /home/usr/dir/{file1,file2,file3,file4} /home/usr/destination ...

  3. dd命令打包多个文件_linux的tar命令详情;linux多个文件压缩打包到一个压缩文件...

    tar命令 可以用来压缩打包单文件.多个文件.单个目录.多个目录. Linux打包命令_tar tar命令可以用来压缩打包单文件.多个文件.单个目录.多个目录. 常用格式: 单个文件压缩打包 tar ...

  4. tracert命令_Windows Tracert命令教程

    tracert命令 Windows operating system provides some basic tools to troubleshoot the network. tracert is ...

  5. bcdedit删除引导_Bcdedit命令教程以及用于编辑Windows引导配置的示例

    bcdedit删除引导 bcdedit is a command line tool used to manage Boot Configuration Data (BCD). This tool c ...

  6. Python 标准库之 os (获取当前目录、读取/设置环境变量、重命名文件、运行shell命令、创建/删除/查看目录文件、判断目录/文件/存在、获取绝对路径、获取文件名、获取换行符、获取路径分隔符)

    1. os与sys模块的官方解释如下: os This module provides a portable way of using operating system dependent funct ...

  7. Linux 文件打包(tar命令——怎么使打包后的文件夹里只有想要的文件而不是有多一个原目录)

    正常打包情况下,打包后的目录下还有个原目录,如下:   怎么去掉这个多余的文件夹呢?如下tar -cvf config.tar -C config/ .   打包包含隐藏目录的文件夹:tar -cvf ...

  8. arcgis批量处理nc文件_法律行业python教程——利用python批量处理文件之批量重命名...

    对法律小伙伴们,尤其是律师助理和做非诉业务的小伙伴们,大量的重复琐碎的文件处理工作是不是常常让人失去工作的兴趣呢? 这里就不得不提到python工具的运用啦,一定要记住编程的思想是什么: 1.制作工具 ...

  9. 技巧 | 如何快速生成文件清单

    最近在整理一些资料,每一个文件夹我都想建一个文本文件来管理,把当前文件下的所有文件的名字都放到到这个文件中,形成类似目录一样的东西,之后要找什么文件就直接看这个管理文件就好了. 如果把当前文件夹下的所 ...

最新文章

  1. 学习java周期_Java第一作业周期总结
  2. SQL中ISNULL的问题。
  3. 11.18-11.19总结(transform,transition,媒体查询,弹性盒子)
  4. 逆向工程核心原理读书笔记-API钩取之记事本小写转大写
  5. 知道python网课答案_Python程序设计答案
  6. jboss as安装配置_书评:JBoss AS 7:配置,部署和管理
  7. 工业机器人导轨 百度文库_工业机器人或许开创一个全新的PLC时代
  8. 计算机教师帮扶记录,信息技术辅导记录.doc
  9. Ionic Cordova实现软键盘的监听 以及操作大全
  10. 内核移植(4)移植yaffs文件系统
  11. Python 异常(Exception)
  12. 从输入url到页面展现发生了什么?
  13. java.lang.UnsatifiedLinkError错误一例:不同虚拟机之间的库不能共用
  14. mysql 不等于查询优化_MySQL查询性能优化
  15. asp.net my sqlHelper
  16. 网站建设需遵循的六个步骤
  17. 2020-11-01 Mybatis TypeAlise、resultMap、日志settings
  18. mysql生成序列_mysql 自动生成编号函数
  19. Spatial Attention
  20. Java操作ffmpeg为视频添加音乐

热门文章

  1. CI24R1 2.4G低成本氛围灯解决方案
  2. docker 进入mysql
  3. [.net 面向对象程序设计进阶] (4) 正则表达式 (三) 表达式助手
  4. 活动星投票教师创课大赛网络评选微信的投票方式线上免费投票
  5. Kubernetes入门与进阶实战培训
  6. 累积计数法的两个应用:骑士的金币和扑克牌魔术
  7. Microsoft LDAP 配置页中输入有效的用户名及密码,microsoft ldap 配置页中输入有效的用户名
  8. python with open使用方法(基础)
  9. 小米手机数据丢失怎么恢复
  10. JAVA朝花夕拾-集合框架