これは、私の(やや面倒な)スクリプトdircompare.shの例です。
- 2 つの再帰パスで、ファイルとディレクトリが発生するディレクトリ (または両方) に応じて、配列内のファイルとディレクトリを並べ替えます。
diff -q
両方のディレクトリにあるファイルは、異なるかどうかによって、2 つの配列に再度並べ替えられます。
- 等しいと主張するファイルについて
diff
は、タイムスタンプを表示して比較します
役に立つことを願っています - 乾杯!
EDIT2:(実際には、リモートファイルで正常に動作します-問題は、ローカルファイルとリモートファイル間の差分操作中にCtrl-C信号が処理されなかったため、時間がかかる場合があります;スクリプトはそれを処理するトラップで更新されました-ただし、参照用に以下の以前の編集):
編集:...リモート ssh ディレクトリのサーバーがクラッシュするように見えることを除いて(これを使用してみました~/.gvfs
)...これはもうありませbash
んが、代わりに を使用することをrsync
お勧めします。例を次に示します。
$ # get example revision 4527 as testdir1
$ svn co https://openbabel.svn.sf.net/svnroot/openbabel/openbabel/trunk/data@4527 testdir1
$ # get earlier example revision 2729 as testdir2
$ svn co https://openbabel.svn.sf.net/svnroot/openbabel/openbabel/trunk/data@2729 testdir2
$ # use rsync to generate a list
$ rsync -ivr --times --cvs-exclude --dry-run testdir1/ testdir2/
sending incremental file list
.d..t...... ./
>f.st...... CMakeLists.txt
>f.st...... MACCS.txt
>f..t...... SMARTS_InteLigand.txt
...
>f.st...... atomtyp.txt
>f+++++++++ babel_povray3.inc
>f.st...... bin2hex.pl
>f.st...... bondtyp.h
>f..t...... bondtyp.txt
...
ご了承ください:
/
上記を取得するには、ディレクトリ名の末尾にある末尾のスラッシュを忘れてはなりませんrsync
--dry-run
- シミュレーションのみ、ファイルを更新/転送しない
-r
- ディレクトリに再帰する
-v
- 詳細 (ただし、ファイル変更情報とは関係ありません)
--cvs-exclude
.svn
-ファイルを無視
-i
- "--itemize-changes: すべての更新の変更概要を出力"
によって表示される情報(たとえば、上記の文字列)
man rsync
を説明する短い抜粋を次に示します。-i
>f.st......
The "%i" escape has a cryptic output that is 11 letters long.
The general format is like the string YXcstpoguax, where Y is
replaced by the type of update being done, X is replaced by the
file-type, and the other letters represent attributes that may
be output if they are being modified.
The update types that replace the Y are as follows:
o A < means that a file is being transferred to the remote
host (sent).
o A > means that a file is being transferred to the local
host (received).
o A c means that a local change/creation is occurring for
the item (such as the creation of a directory or the
changing of a symlink, etc.).
...
The file-types that replace the X are: f for a file, a d for a
directory, an L for a symlink, a D for a device, and a S for a
special file (e.g. named sockets and fifos).
The other letters in the string above are the actual letters
that will be output if the associated attribute for the item is
being updated or a "." for no change. Three exceptions to this
are: (1) a newly created item replaces each letter with a "+",
(2) an identical item replaces the dots with spaces, and (3) an
....
確かに少し不可解ですが、少なくとも基本的なディレクトリ比較を示していssh
ます。乾杯!