如何将 svn 中保存为文本/ascii 的图像批量转换为二进制?
不知何故,图像被保存为 text/ascii,我需要递归地对数百个图像目录执行此操作,所有这些目录都在一个根 images
目录下。
我收到了一些说明 这里告诉我:
svn proplist <yourfile>
svn propdel svn:eol-style <yourfile>
svn propset svn:mime-type application/octet-stream <yourfile>
是否有一些本地 svn 递归方法可以做到这一点?如果没有,有人可以建议我如何使用 bash 脚本递归地应用它吗?
Somehow images got saved as text/ascii and I need to recursively do this for hundreds of directories of images, all under one root images
directory.
I got some instructions here which tell me to:
svn proplist <yourfile>
svn propdel svn:eol-style <yourfile>
svn propset svn:mime-type application/octet-stream <yourfile>
Is there some native svn recursive way I can do this? If not, could someone advise how I could recursively apply this with a bash script?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
外壳上:
On the shell:
我没有可以测试这一点的 Subversion 存储库,但这应该不会太困难:
这将列出工作目录中的所有文件(不包括 .svn 目录)。
现在,您可以将其与 while read 循环结合起来。
现在,您注意到我没有验证文件是否设置了该属性。我根本不在乎。而且,这将处理每个文件。如果您只想处理特定类型的文件,则必须修改
find
命令:我强烈建议您从一个干净的 Subversion 工作目录开始,然后运行如下测试
:输出看起来不错,然后删除
echo
并让 'er rip。I don't have a Subversion repository where I can test this out, but it shouldn't be too difficult:
This will list all of the files in your working directory (sans the .svn directories).
Now, you can combine this with a while read loop
Now, you notice I'm not verifying whether or not the files have that property set or not. I simply don't care. And, this will do every file. If you want only to do a particular type of file, you'll have to modify the
find
command:I highly suggest you start with a clean Subversion working directory, and run a test like this:
If the output of that looks good, then remove the
echo
and let 'er rip.以下 powershell 代码将实现您想要做的事情:
The following powershell code will achieve what you're looking to do: