在 bash 中,使用“svn mv”将目录中的每个文件大写;
我需要更改 subversion 工作副本中一组文件的大小写,如下所示:
svn mv test.txt Test.txt svn mv test2.txt Test2.txt svn mv testn.txt Testn.txt ... svn commit -m "caps"
如何自动化此过程? 提供标准 Linux 安装工具。
I need to change the capitalization of a set of files in a subversion working copy, like so:
svn mv test.txt Test.txt svn mv test2.txt Test2.txt svn mv testn.txt Testn.txt ... svn commit -m "caps"
How can I automate this process? Standard linux install tools available.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
如果你安装得当,你应该有 python,试试这个:
If you have a decent install you should have python, give this a try:
我认为没有一种简单的方法可以使用 bash/sed/tr/find 来做到这一点。
我会制作一个 Ruby/Perl 脚本来进行重命名。
然后就做
或者如果你想做整个目录
I don't think theres an easy way to do it with bash/sed/tr/find.
I'd make a Ruby/Perl script that does the renaming.
Then just do
or if you want to do a whole dir
请注意,此更改会破坏 Windows 和 Mac 系统上的现有工作副本,因为它们无法处理仅大小写重命名。
Please note that this change breaks existing workingcopies on Windows and Mac systems, as they can't handle case only renames.
我通常通过将 'ls' 输出重定向到文件,使用 vim 宏将每个文件名调整到我想要的命令行中,然后将文件作为 shell 脚本执行。 这很粗糙但很有效。
I typically do this by redirecting the 'ls' output to a file, using vim macros to massage each filename into the command line I want, then execute the file as a shell script. It's crude but effective.
LS | awk '{system("svn mv " $0 " " toupper(substr($0,1,1)) substr($0,2))}'
显然,其他脚本语言也可以工作。 awk 的优点是它无处不在。
ls | awk '{system("svn mv " $0 " " toupper(substr($0,1,1)) substr($0,2))}'
obviously, other scripting languages will work just as well. awk has the advantage that it it ubiquitous.