获取所有文件夹的列表,但不是文件 [英] Getting list of all folders but not the files

查看:42
本文介绍了获取所有文件夹的列表,但不是文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 svn 命令从 svn 收集所有文件夹和子文件夹.名单很大.

I am trying to use the svn commands to gather all folders and subfolders from svn. The list is huge.

我尝试在 svn 上创建一个空文件夹并将其与基础进行比较,但它在 4 小时后崩溃了.

I have tried making an empty folder on svn and compare it with the base but it crashes after 4 hours.

我今天早上尝试了以下方法:

I have tried the following this morning :

svn list --depth infinity http://serverip/svn/root/ 

它已经运行了将近 6 个小时,但仍未完成,它列出了所有文件.

and it has been running for nearly 6 hours so far and still not finished and it lists all the files.

我在旁边尝试了其他几种带有 grepegrep 参数的方法,但无法识别,所以我相信它们可能是 Bash 命令,而我在 Windows 上这将解释为什么它没有做任何好事.

I tried on the side a couple other ways with grep and egrep parameters but it is not recognized so i believe they might be Bash commands and i am on windows so that would explain why it's not doing anything good.

我想要的是根目录下的所有文件夹和子文件夹.如果可能的话,我会使用命令过滤特定的文件夹名称,如/tag-088/121359/".如果我不能在命令中进行过滤,这没什么大不了的,在 excel 或类似的东西中过滤自己是很容易的.主要目标是只选择文件夹和子文件夹,而不是文件.

All i want is all folders and subfolders within the root. And if possible with the command i would filter on specific folder names like "/tag-088/121359/". If i cannot filter in the command it's not a big deal it's very easy to filter myself within excel or something like that. The main goal is to only pick folder and subfolder and not files.

我有大约 4.2 TB 的 svn,所以它可能有点慢,这就是为什么我试图在没有文件的情况下列出.

I have about 4.2 terabyte svn so it is a bit slow probably because of that so that is why i am trying to list without the files.

推荐答案

如果您可以访问服务器(我假设您可以访问,因为您很清楚存储库的大小),您可以考虑使用 svnlook 程序.与 svn 一样,svnlook 提供了一组子命令.您将需要 svnlook tree 子命令,特别是 --full-paths 选项,它会导致它每行打印一个路径而不是使用嵌套/缩进方法.通过一个 grep 管道传输,它只保留以斜杠字符结尾的输出(仅适用于目录路径),您将获得所需的列表.

If you have access to the server (which I assume you do, given that you know well the size of the repository), you might consider using the svnlook program. Like svn, svnlook offers a collection of subcommands. You'll want the svnlook tree subcommand, and specifically the --full-paths option which causes it to print its output one-path-per-line instead of using a nested/indented approach. Piped through a grep that keeps only output which ends in a slash character (true only of directory paths), you'll have the list you seek.

$ svnlook tree /path/to/repos --full-paths | grep '/$'
/
/trunk/
/trunk/dir/
/trunk/otherdir/
/tags/
/tags/my-tag/
/tags/my-tag/dir/
/tags/my-tag/otherdir/
...

这篇关于获取所有文件夹的列表,但不是文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆