如果模式中包含目录,Cygwin diff将不会排除文件 [英] Cygwin diff won't exclude files if a directory is included in the pattern

查看:152
本文介绍了如果模式中包含目录,Cygwin diff将不会排除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要做一个递归diff使用cygwin需要排除所有.xml文件从某些目录,但不是从其他目录。根据--help选项,我应该能够与--exclude = PAT选项,其中PAT是描述我想要从差异排除的文件的模式。



如果我这样做:

  diff -rw --exclude =classes / Services.xml

diff不会忽略classes目录中的Services.xml文件。如果我这样做

  diff -rw --exclude =Services.xml



该diff会忽略所有目录中的Services.xml文件。



做这样的事情:

  diff -rw --exclude =* / generated / resources / client / *。xml$ b / b $ b 

忽略目录中的所有.xml文件* / generated / resources / client /

每当我向--exclude模式添加路径信息时,cygwin不会忽略我在模式中指定的文件。



有没有办法让cygwin diff识别一个模式,识别某些目录中的某些文件?似乎无法处理任何目录信息。

解决方案

我最终不得不写一个Java实用程序目录树,不包括某些目录,并在每个级别调用diff。


I need to do a recursive diff using cygwin that needs do exclude all .xml files from certain directories, but not from other directories. According to the --help option I should be able to do this with with the --exclude=PAT option where PAT is a pattern describing the files I want to exclude from the diff.

If I do this:

diff -rw --exclude="classes/Services.xml" 

the diff does not ignore the Services.xml file in the classes directory. If I do this

diff -rw --exclude="Services.xml"

the diff does ignore the Services.xml file in all directories.

I need to do something like this:

diff -rw --exclude="*/generated/resources/client/*.xml"

to ignore all .xml files in the directory */generated/resources/client/.

Whenever I add path information to the --exclude pattern cygwin does not ignore the file(s) I've specified in the pattern.

Is there some way to make cygwin diff recognize a pattern that identifies certain files in certain directories? It seems to not be able to handle any directory information at all.

解决方案

I ended up having to write a Java utility that walks the directory tree, excluding certain directories, and calls diff on each level.

这篇关于如果模式中包含目录,Cygwin diff将不会排除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆