Program Tip

파일이없는 폴더 및 하위 폴더 목록을 얻으려면 어떻게합니까?

programtip 2020. 10. 18. 19:03
반응형

파일이없는 폴더 및 하위 폴더 목록을 얻으려면 어떻게합니까?


디렉토리 폴더하위 폴더 목록을 파일 로 인쇄하려고 합니다.

를 실행 dir /s/b/o:n > f.txt하면 파일 목록도 표시됩니다. 폴더와 하위 폴더 만 필요합니다.

누구든지 명령 줄 인터페이스에서이 작업을 수행 할 수 있다는 것을 알고 있습니까?


이 시도:

dir /s /b /o:n /ad > f.txt

 Displays a list of files and subdirectories in a directory.

 DIR [ drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
  [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

  [drive:][path][filename]
          Specifies drive, directory, and/or files to list.

  /A          Displays files with specified attributes.
  attributes   D  Directories                R  Read-only files
           H  Hidden files               A  Files ready for archiving
           S  System files               I  Not content indexed files
           L  Reparse Points             -  Prefix meaning not

귀하의 경우 / A : D (디렉토리)에서 원하는 파일 속성 유형을 설정하십시오.

디렉토리 / s / b / o : n / A : D> f.txt


을 사용 dir /s /b /o:n /a:d했고 완벽하게 작동했습니다. 파일 작성이 완료되었는지 확인하십시오. 그렇지 않으면 불완전한 목록이 생성됩니다.


나는 어떤 대답에 대해서도 논평 할만한 충분한 평판이 없습니다. 댓글 중 하나에서 누군가가 목록의 숨겨진 폴더를 무시하는 방법을 물었습니다. 다음은이를 수행하는 방법입니다.

dir /b /AD-H

dir /ad /b /s 필요한 답변을 제공합니다.


PowerShell에서 이것을 사용하고 있습니다.

dir -directory -name -recurse > list_my_folders.txt

참고 URL : https://stackoverflow.com/questions/16078421/how-do-i-get-a-list-of-folders-and-sub-folders-without-the-files

반응형