![Windows: 디렉터리의 파일에 대한 탭으로 구분된 정보 목록을 만드는 방법](https://rvso.com/image/1645756/Windows%3A%20%EB%94%94%EB%A0%89%ED%84%B0%EB%A6%AC%EC%9D%98%20%ED%8C%8C%EC%9D%BC%EC%97%90%20%EB%8C%80%ED%95%9C%20%ED%83%AD%EC%9C%BC%EB%A1%9C%20%EA%B5%AC%EB%B6%84%EB%90%9C%20%EC%A0%95%EB%B3%B4%20%EB%AA%A9%EB%A1%9D%EC%9D%84%20%EB%A7%8C%EB%93%9C%EB%8A%94%20%EB%B0%A9%EB%B2%95.png)
Linux 사용자로서 Windows에서 cmd.exe를 사용하여 다음 문제를 해결할 방법이 없습니다.
탭으로 구분된 다음 정보를 사용하여 지정된 디렉터리의 모든 파일을 반복적으로 나열하고 싶습니다.
- 전체 경로
- 파일 이름이 없는 전체 경로
- 파일 이름
- 파일 접미사
- 마지막 변경의 타임스탬프
- 최근에 파일을 터치한 사용자
예를 들어
c:\folderA\file1.txt<tab>c:\folderA<tab>file1.txt<tab>txt<tab>2016-02-18 15:18:29 +0100<tab>USER_X
c:\folderA\file2.txt<tab>c:\folderA<tab>file2.txt<tab>txt<tab>2018-02-28 14:28:44 +0100<tab>USER_Y
c:\folderA\folderAA\file3.xlsx<tab>c:\folderA\folderAA<tab>file3.xlsx<tab>xslx<tab>2011-12-01 05:22:01 +0100<tab>USER_Z
이름에 공백이 포함된 파일과 폴더가 있을 수 있습니다.
어떤 제안이 있으십니까? 감사합니다!
답변1
사용파워셸대신에cmdpowershell 명령 Get-ChildItem
별칭 사용GCI
전체 명령:
gci -r | % { $_.Name,$_.FullName,$_.LastWriteTime -join ' ' } | Out-File YourOutputfile.txt
gci
Get-ChildItem
-r
재귀적
$_.Name
파일 이름
$_.FullName
파일 전체 경로
동일한 출력:
Get-ChildItem -r | % { $_.Name,$_.FullName,$_.LastWriteTime -join ' ' } | Out-File YourOutputfile.txt
그래도 사용하고 싶다면 Enter 키를 cmd
입력 for /?
하고 이 섹션을 읽어보세요.
%~I - expands %I removing any surrounding quotes (")
%~fI - expands %I to a fully qualified path name
%~dI - expands %I to a drive letter only
%~pI - expands %I to a path only
%~nI - expands %I to a file name only
%~xI - expands %I to a file extension only
%~sI - expanded path contains short names only
%~aI - expands %I to file attributes of file
%~tI - expands %I to date/time of file
%~zI - expands %I to size of file
%~$PATH:I - searches the directories listed in the PATH
environment variable and expands %I to the
fully qualified name of the first one found.
If the environment variable name is not
defined or the file is not found by the
search, then this modifier expands to the
empty string
The modifiers can be combined to get compound results:
%~dpI - expands %I to a drive letter and path only
%~nxI - expands %I to a file name and extension only
%~fsI - expands %I to a full path name with short names only
%~dp$PATH:I - searches the directories listed in the PATH
environment variable for %I and expands to the
drive letter and path of the first one found.
%~ftzaI - expands %I to a DIR like output line