10

How can I write a bash script to list directory entries in the svn repository? I want to write bash file because i have a large number of repositories.

6
  • 3
    When will people stop writing "HELP ME" :/ @Mohammad: Clarify your question. What exactly is it you want to do? Commented Sep 19, 2010 at 12:56
  • 1
    i write help me because i start to learn linux after 2 days ... and i have big work in it and in the following comment clear explain of my problem Commented Sep 19, 2010 at 13:02
  • ok ... see the following example.... i do the following :- execute the this command to find the repository :- "sudo find / -type f -name fs-type -print " the following result appear :- "/var/lib/svn/repos/b1me/products/payone/impl/VJ/resources /var/lib/svn/repos/b1me/products/payone/impl/JKB/code/iris" and more maybe 500 repository now i want to show content of each repository for Followed in the next comment >> Commented Sep 19, 2010 at 13:03
  • now i want to find the content of each repository for example :-"/var/lib/svn/repos/b1me/products/payone/generic/code/core" so i execute this command :- "svn list svn+ssh://svn.sts.com.jo/var/lib/svn/repos/b1me/products/payone/generic/code/core" but i have maybe 500 repository it is very complex to execute it for each one ...Taking into account each one require password – Commented Sep 19, 2010 at 13:03
  • 1
    please i want to ask you .... no body answer this question WHY ? ... i ask more than "20" person and the same answer "i don't know" ... please i need the answer as soon as possible :( Commented Sep 19, 2010 at 13:14

1 Answer 1

30

If you are the subversion administrator, the following command will return the directories located in your repository.

svnlook tree $REPO_DIR --full-paths | egrep "/$" 

The trick is the grep command that is looking for a trailing "/" character in the name

Same trick works for the svn command as well

svn list $REPO_URL -R | egrep "/$" 

Extra notes

To repeatedly run this command you can put it into a shell for loop

for url in $URL1 $URL2 $URL2 do svn list $url -R | egrep "/$" done 
Sign up to request clarification or add additional context in comments.

12 Comments

i try it now but the follwing result appear:- svnlook: invalid option: --full-paths Type 'svnlook help' for usage.
when i execute svn list $REPO_URL -R | egrep "/$" the following result svn: '.' is not a working copy
Yes.... And I get the same result when running the following command: "svn list $I_SHOULD_REPLACE_THIS_WITH_MY_OWN_URL_LOCATION -R". Please use a valid subversion URL when running the command
iam sorry i don't have expert in this field ... and i under big press... you mean like this "svn list $/var/lib/svn/repos -R | egrep "/$" " if you mean this the following result appearsvn: '$/var/lib/svn' is not a working copy
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.