I am trying to perform a big checkin of a lot of semi-automatically generated files, and they should all have svn:mime-type
properties. I've set a lot using find
, but how do I now find all those remaining files that are to be added and which haven't had a MIME type assigned?
views:
34answers:
2
+1
A:
You could do something like this.
Have a script like this:
#!/bin/sh
for x do
mt=`svn propget svn:mime-type $x`
if [ -z $mt ]; then
echo "setting mime-type for $x"
svn propset svn:mime-type MIME_TYPE_HERE $x
fi
done
Then you could call it via xargs
and find
find . -type f -name "newfile*" -print | xargs my_check_script.sh
seth
2009-07-16 05:35:28
I'd probably want echo $x inside that if, but yeah, that seems reasonable.
Michael Norrish
2009-07-16 05:53:17
ok, updated my answer a bit.
seth
2009-07-16 06:11:35
A:
Following Seth's basic idea, I did
for x do
mt=$(svn pg svn:mime-type $x 2> /dev/null)
if [ -z $mt ]
then
echo $x
fi
done
in the file no-mime-type.sh
(made executable etc etc). Then
find . -type f \! -regex '.*\.svn.*' | xargs no-mime-type.sh
There's probably a better way to avoid the .svn
directories that are lying around.
Michael Norrish
2009-07-16 06:04:31