重命名文件&目录 {searchstr} 与 {replacestr}
我有一个创建模板化目录结构的应用程序(Templify),但它似乎无法用我确定的目标重命名“__NAME__”。
如果我能找到一种干净的方法来重命名所有文件和文件,那就很好了。包含我的替换文本的目录。
我找到了一个重命名文件的 rename.pl 方法,并且发现了一些代码可以删除文件名中的下划线并将其替换为空格......但是当我修改代码以放入搜索词时,它似乎永远不起作用。
所以,基本上,我需要将“__NAME__”替换为“Project-Name”之类的内容。
我很高兴为将来的每次重用修改搜索字符串,但我很想弄清楚如何创建一个可以向其传递 ARGS 的文件。
我在 XP 上并且可以使用 cygwin (cygwin 似乎没有“重命名”,这使得使用“重命名”功能很难找到 linux 类型的解决方案......)
我确实找到了 this 这对于当前目录中的文件很容易使用,但我不知道不知道足够告诉它递归到子目录。
任何帮助都会很棒。
谢谢, 斯科特
I have an application (Templify) that creates a templatized directory structure, but it seems to not be able to rename the "__NAME__" with what I've identified as the target.
This is fine if I can find a clean way to rename all files & directories with my replacement text.
I found a rename.pl method that renames files, and I found some code that removes underscores in file names and replaces it with spaces... but when I modify the code to put in my search terms, it never seems to work.
So, basically, I need to replace "__NAME__" with something like "Project-Name".
I'm happy to modify the search strings for each future reuse, but I'd love to figure out how to create a file to which I can pass ARGS.
I'm on XP and can use cygwin (cygwin doesn't seem to have 'rename' which makes it hard to locate linux-type solutions with using the function called 'rename'....)
I did find this which is easy to use for files in the current directory, but I don't know enough to tell it to recurse into sub-directories.
Any help would be great.
Thanks,
Scott
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
来自 cygwin:
或使用 python:
From cygwin:
Or using python: