English 中文(简体)
2. 确定名录的文字
原标题:Script to determine directory diff

我有两个目录,是同一软件包的不同版本。 因此,我要列出在这两者之间发生变化的所有档案/指示,将这些差异复制到新的目录。

我正在尝试使用<代码>md5sum<>/code>和diff-Nurq的不同文字,但 t无法取得结果Im 。

任何建议?

http://www.ohchr.org。

我最初尝试采用<代码>md5sum<>/code>,但当新档案丢失时,这种编号似乎行不通。

Next I tried a loop like this:

for x in `diff -Nurq ./dir1/ ./dir2/ | awk -F" "  {print $4} `
do 
  mkdir -vp ./dir_1_2_upgrade/$x; 
  cp $x ./dir_1_2_upgrade/$x
done

但是,这最终形成了一个目录,没有档案。

最佳回答
source=SOME_DIR
dest=OTHER_DIR

# TODO: rewrite as awk script
delta=`diff -ur $source $dest`
deleted=`echo "$delta" | grep "^Only in ${source}:" | sed "s/^Only in ${source}: //"`
added=`echo "$delta"   | grep "^Only in ${dest}:"   | sed "s/^Only in ${dest}: //"`
changed=`echo "$delta" | grep  ^+++  | awk  {print $2} `

echo $deleted
echo $added
echo $changed

如果档案名称没有空间,则工程。 如果你想尽量概括地这样做,就会检查项目的来源,例如:git-diff<<<<<<<<>>/a>。

问题回答

暂无回答




相关问题
XML Diff: How to generate XML diff using XSLT?

I would like to compute the diff between two XML files or nodes using XSL/XSLT. Is there any stylesheet readily available or any simple way of doing it?

diff/merge tool for TortoiseSVN within Visual Studio

We ve recently "upgraded" from Visual SourceSafe to SVN based on recommendations on this site. Our current source control set-up is: TortoiseSVN with VisualSVN. We re very happy with it so far, but I ...

How do I get each comp result?

I would like to check diffs and when files are not same,stop compare files. Compare any files C:/UML/reports/* and C:/UML/Test/*. In this two directory has same file names and also aim is to want to ...

Find differences between 2 HTML files

Is there a way to display differences between two HTML documents? There is a PHP class called daisdiff, but it has no documentation. Can anyone show how to use it, or any alternative?

How to specify different --strip (-p) levels for patch?

If I have a diff that has paths like these: --- a/b/foo/bar/baz.pl +++ c/foo/bar/baz.pl Is there a way to tell the patch utility that the diff roots are at different levels? i.e. -p2 for one, yet -...

热门标签