简体   繁体   English

将文件夹结构和子目录/文件导出到文本

[英]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.

相关问题 从文本列表复制文件并保留文件夹结构 - Copy files from a text list and preserve folder structure 循环浏览子目录中的文件夹并合并文本文件 - Loop through folders in subdirectories and combine text files 将文本文件中具有字符串结构的多个子文件夹中与字符串匹配的文件复制到另一个目标文件夹 - Copy files matching string(s) in a text file out of many subfolders with folder structure to another destination folder 如何将子目录中的文件批量移动到 Windows 中的一个文件夹下? - How to batch move files in subdirectories down one folder in Windows? 将通配符文件夹结构文件移动到目标文件夹 - Move Wildcard Folder structure files to a destination folder 如何合并所有子目录中具有相同名称的文本文件? - How to merge text files with the same name from all subdirectories? 从动态文件夹结构复制文件[Windows] - Copying files from a dynamic folder structure [Windows] 在子目录中查找文件的脚本 - Script to find files in subdirectories Windows批处理-尝试合并所有子目录中具有相同名称的文本文件时出现空文件 - Windows Batch - empty files while trying to merge text files with the same name from all subdirectories 将文件列表(和文件夹结构)导出到文件(Windows 10) - Export list of files (and folder structure) to a file (Windows 10)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM