使用PowerShell根据内容重命名大量文本文件 [英] Using PowerShell to rename large numbers of text files based on content
问题描述
我需要重命名几千个文本文件。正确的文件标题是"通常"。文档中的第一个文本行,但在标题之前可以有一个或多个空行或一个或多个非字母数字字符。
此外,其中一些文档是单个较大文档的细分。最后,一些文档是现有文档的更高版本。我希望能够提取文档的正确标题,然后使用这些提取
来重命名相应的文件,并为任何重复的标题添加版本号。 这是否可以,有人请给我一些想法如何使这项工作?
I have several thousand text files that I need to rename. The correct document title is "usually" the first text line in the document, however there can be one or more blank lines or one or more non-alpha-numeric character before the title. In addition, some of these documents are segments of a single, larger document. Finally, some of the documents are later versions of existing documents. I would like to be able to extract the documents' correct titles, then use those extractions to rename the corresponding files, and to add version numbers for any duplicate titles. Is this do-able, and would someone please give me some ideas how I could make this work?
谢谢,
Dan
推荐答案
什么样的文件?
What kind of documents?
这篇关于使用PowerShell根据内容重命名大量文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!