如何获取没有svn:mime-type属性设置的待添加文件列表?

时间:2022-03-19 23:11:02

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?

我正在尝试对大量半自动生成的文件进行大量检查,并且它们都应该具有svn:mime-type属性。我已经使用find设置了很多,但是我现在如何找到要添加的所有剩余文件以及未分配MIME类型的文件?

2 个解决方案

#1


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

然后你可以通过xargs调用它并找到

find . -type f -name "newfile*" -print | xargs my_check_script.sh

#2


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

在文件no-mime-type.sh(制作可执行文件等)中。然后

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.

可能有更好的方法来避免存在的.svn目录。

#1


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

然后你可以通过xargs调用它并找到

find . -type f -name "newfile*" -print | xargs my_check_script.sh

#2


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

在文件no-mime-type.sh(制作可执行文件等)中。然后

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.

可能有更好的方法来避免存在的.svn目录。