Getting list of all folders but not the files

和自甴很熟 提交于 2019-12-24 08:48:32

问题


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

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/ 

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

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.

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.

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.


回答1:


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/
...


来源:https://stackoverflow.com/questions/48954435/getting-list-of-all-folders-but-not-the-files

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!