[英]Exporting Folder Structure & Subdirectories/files to text
I am trying to export the folder structure and it's files of my portable hard drive to a text file to have offsite access. 我正在尝试将文件夹结构及其便携式硬盘驱动器的文件导出到文本文件以进行异地访问。
I want to be able to copy the folder structure of my Music folder (100 GB+) to a text file including the files within the nested folders. 我希望能够将“音乐”文件夹(超过100 GB)的文件夹结构复制到一个文本文件中,包括嵌套文件夹中的文件。
Note: I only want to copy the structure and layout of the folder and it's subdirectories and files, not the actual file. 注意:我只想复制文件夹及其子目录和文件的结构和布局,而不是实际文件。
I did some searching and found the following command used in PowerShell to acheive an output like I desire but it doesn't give me the filelist inside subfolders. 我进行了一些搜索,发现在PowerShell中使用以下命令来实现所需的输出,但它没有给我子文件夹中的文件列表。
The command was: 命令是:
Get-ChildItem | tree > Music_Structure.txt
I would like something similar to the following output in the text file. 我想要类似于文本文件中以下输出的内容。
C:. ├───Music │ ├───Eminem │ │ └───The Eminem Show │ │ └───01 Curtains Up (skit).flac 02 White America.flac
and so on. 等等。
I have tried other options such as Command Prompt tree
command and dir
command but doesn't give me a clean output. 我尝试了其他选项,例如命令提示符tree
命令和dir
命令,但没有给我干净的输出。
Looking for a certain command or method that I can do every other month to maintain that text file. 寻找我隔两个月可以做的某种命令或方法来维护该文本文件。
Operating System: Windows 10 x64 Version 1809 作业系统:Windows 10 x64版本1809
You just need to use tree /F
and then it will include the files in the folders. 您只需要使用tree /F
,然后它将在文件夹中包含文件。 You also don't need to use Get-ChildItem
at all, you can just provide a path to tree: 您也根本不需要使用Get-ChildItem
,只需提供树的路径即可:
tree /f c:\your\music\folder > Music_Structure.txt
Note also that tree
is not a PowerShell command but rather a command line executable, so you can use it directly in a command prompt. 还要注意, tree
不是PowerShell命令,而是命令行可执行文件,因此您可以在命令提示符下直接使用它。
~> tree /?
Graphically displays the folder structure of a drive or path.
TREE [drive:][path] [/F] [/A]
/F Display the names of the files in each folder.
/A Use ASCII instead of extended characters.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.