What is the easiest way to run a command in each subfolder of a path? In this case I have to run svn cleanup for every directory in my repository.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I have found that in such cases it is much easier to just delete the working copy and re-checkout. If you have local changes, then copy the changed files elsewhere first.
But Can’s answer might work in your case, unless SVN has greater problems. Though you probably have to run it several times since it would begin at the root folder which would still have problems, then. You’d need some kind of post-order traversal in that case which can’t be done with
for /rbut which can ensure that you would start with the lowest directories in the hierarchy to clean up.You’d also need to exclude SVN’s statekeeping directories .svn:
As for the post-order traversal, you can build a little batch:
On the following tree:
a ├───.svn ├───a1 │ └───.svn └───a2 └───.svn b ├───.svn ├───b1 │ ├───.svn │ ├───b11 │ │ └───.svn │ └───b12 │ └───.svn └───b2This yields the following output:
which, as you can see, makes sure that the lowest directories are processed first and the .svn directories are skipped. Remove the
echoif you want to use it. This could resolve your problem. Maybe.