How can I use findunix utility to find all working copies on a machine? For example, I can use the command find / -name .svn -type d, but it displays all redundant results (many subfolders), while I only need the parent directory of the working copy to display.
find
find / -name .svn -type d
There is a question related to this, but in my case it really does not help: How to find the root folder for a given working copy of a subtree
maybe something like this?
#!/bin/bash if [ -d "$1/.svn" ]; then echo $1 else for d in $1/* do if [ -d "$d" ]; then ( $0 $d ) fi; done fi;
, , - find_svn.sh, ./find_svn.sh /var/www ( , ... , - ).
./find_svn.sh /var/www
Update 3 - , .svn . .
Perl :
find -s . -ipath *.svn | perl -lne's!/\.svn$!!i;$a&&/^$a/||print$a=$_'
: svn, /.svn, , , .
/.svn
: :
$ find . . ./1 ./1/.svn ./1/1 ./1/1/.svn ./2 ./2/.svn ./3
./1 ./2
GNU find/sort
find /path -type f -name ".svn*" -printf "%h\n" | sort -u
The following works are just fine for me. It also finds all rare checks (or nested working copies).
find $PWD -type d -wholename "*/.svn" | while read path do path=${path%%/.svn} wcr=$(svn info ${path} 2>/dev/null | perl -F"/:\s/" -le '{ print $F[1] if $F[0] =~ /^Working Copy Root/; }') [ "$path" = "$wcr" ] && { echo -e "\n WC Root $path"; svn stat -qu $path; } done
Source: https://habr.com/ru/post/1729928/More articles:Facebook policy file error - flashUsing a custom WebControl as the DefaultButton for a panel - asp.netThe best language for creating a drum emulator (Rock Band Input) - musicSqlite & mysql field types? - mysqlImplementation of IEnumerable works for foreach but not LINQ - genericsGet date range from one date - dateIs it always 1 in SQL? - comparisonSelect a varchar column with the IN () part in the condition, and the int value returns all rows - mysqlPuzzles - iphonejavascript: find screen resolution with multiple monitors - javascriptAll Articles