bash - execute on each directory within a directory
Hello all,
I need some help writing a bash script. I need to execute a svn-dump on each directory within my svn-directory and then name the dumpfile whatever the directory was called with ".dump" as the extension. Here is what I have so far: Code:
#!/bin/bash You can probably tell I have no idea what I'm doing a little help would go a long way. =) |
Your script seems pretty close to the mark to me!
A couple minor notes: It's best to avoid using 'ls' when you can just use globbing - it's faster and easier to read. Also, you should always use quotes around filenames in case they have spaces in them. You can check if a file is a directory with the if [ -d "$file" ] construct. Working on the assumption that you want the .dump files in the /var/svn folder, here's what I came up with. Code:
#!/bin/bash |
Also, have a look at svnbak.pl. It takes care of backing up and rotating/archiving...
http://www.zulius.com/freebies/perl-...-repositories/ |
Thanks Julian! That worked great. Glad to know I was kinda close myself =P
I will look into svnbak.pl spankbot. Thanks. |
All times are GMT -5. The time now is 04:27 AM. |