Date: Tue, 19 Jan 1999 11:24:43 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Dirk Färber cc: djgpp AT delorie DOT com Subject: Re: directory compare In-Reply-To: <77vrl2$p2$1@newsserver.rrzn.uni-hannover.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from QUOTED-PRINTABLE to 8bit by delorie.com id EAA08655 Reply-To: djgpp AT delorie DOT com On 18 Jan 1999, Dirk Färber wrote: > Did I get you right, that find can compare size and date with > another file to chose copy or no copy including the direction? Yes, although the direction change might require to invoke `find' twice. > And find does this action recursive for a several levels? Yes. You can either let `find' do this recursively up to the deepest level, or limit the depth using the -mindepth and -maxdepth options. > If yes: I didn't find this option for find. Here's a command that copies only those files from the current directory that are newer than respective files in a:/backup: find . -not -type d -exec cp -puP {} a:/backup (You will need the port of `cp' from Textutils for this.) This relies on features of GNU `cp' (the -u and -P options are GNU extensions). If you want to compare sizes as well, you will have to use something more complex. For example, if the size should be more than some constant, you could use the -size option of `find'. Other cases can be solved by invoking a small shell script or a simple program via -exec. The above is intentionally vague, since I don't understand the fine details of what you are trying to do. But the important point is that using `find' and simple shell scripts/programs you can get a powerful tool in a matter of minutes, with minimal development effort. Finally, don't forget the small wonder called `update.exe' which is distributed with DJGPP. It will copy one file over another if and only if their contents differ. You can use it either directly or via -exec option of `find'.