在特定目录中递归创建文件夹
在最近的备份/恢复周期中,我意识到我设法省略了“.svn”目录中的“tmp”目录,因此我无法更新我的工作副本。如果我手动创建一个新的空“tmp”目录,问题就会消失,因此我正在寻找一种方法来递归地遍历每个文件夹,找到“.svn”文件夹并在其中创建一个“tmp”文件夹。
因为我不想弄乱现有的文件夹,所以我想在做一些愚蠢的事情之前寻求帮助:)
评论/建议将不胜感激,谢谢!
PS:这是在 Windows 机器上,所以遗憾的是 Bash 和其他 unix 实用程序不存在。
During a recent backup/restore cycle I've realized that I managed to omit the 'tmp' directories from within the '.svn' directories, and because of this I can't update my working copies. The problem goes away if I manually create a new, empty 'tmp' directory so I am looking for a way to recursively go through each folder, find '.svn' ones and create a 'tmp' folder inside them.
As I don't want to mess up the existing folders I thought I's ask for help before I did something silly :)
Comments/suggestions will be appreciated, thanks!
PS: This is on a Windows machine so sadly Bash and other unix utilities are not present.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
上面的脚本在我的 Windows 7 机器上不起作用。 “
dir /b /s .svn
”没有获取所有目录,我收到“找不到文件”错误。我将脚本更改为除了选择目录之外还包含 /ad,这有效!这是对我有用的脚本。
The script above doesn't work on my on Windows 7 machine. The "
dir /b /s .svn
" doesn't get all dirs, I get a "File Not Found" error.I changed the script to have /ad in addition to select directories only and that works! Here is the srcipt which works for me.
取决于有多少人。
使用 Edit dirs.bat 列出目录
在您选择的编辑器中 。在每行的开头添加
md
(因为每行都以 C: 之类的内容开头,您可以使用相当愚蠢的编辑器 - 包括记事本 - 将 C: 更改为md C:
).将 /tmp 添加到每行末尾(将.svn
替换为.svn\tmp
)。节省。运行 BAT 文件工作完成。
Depends on how many there are.
List the directories with
Edit dirs.bat in your editor of choice. Add
md
at the beginning of each line (since each line begins with something like C: you can use a fairly dumb editor - including notepad - to change C: tomd C:
). Add /tmp to the end of each line (replace.svn
with.svn\tmp
). Save. Run the BAT fileJob done.
以下是如何自动化整个过程。将以下内容放入
fixtmp.cmd
等文件中:Here's how to automate the entire process. Put the following in a file like
fixtmp.cmd
: