in reply to searching and modifying two directory trees

I'd solve this with rsync. I think its defaults even mirror the logic you requested. I use this on my Windows XP laptop to mirror my data up to my network share. I have to add options to get it to delete stuff on the target side - the default is to ignore target-side stuff that doesn't already exist on the source.

$ rsync source_dir target_dir

Added, minutes later.

Alternatively, you can use an iterator form of File::Find at Re: Re: (Perl6) Groking Continuations (iterators) and then just walk each directory tree in sequence. This will allow you to write this in perl with no serious problems. Its still easier to just have rsync handle it.

Replies are listed 'Best First'.
Re^2: searching and modifying two directory trees
by argv (Pilgrim) on Nov 25, 2004 at 02:46 UTC
    If it weren't for the fact that I need (or would like) to integrate this into a much broader package of perl tools that I'm writing, rsync would be great. Perhaps the broader solution would be modify File::Find to support new(), so that unique iterations can be instantiated on an as-needed basis.

    Also, it be nice if the wanted code could return a boolean to indicate whether the caller should continue. This could be nice for those looking to scan directories that have thousands of entries.

    BTW, where's rync for WinXP? It doesn't seem to be part of my cygwin distribution... perhaps it was an option I didn't select? darn, and it's been a while since I even installed this stuff... ok, I guess i'll go look. dan

      where's rync... perhaps it was an option I didn't select?

      Yes, you did not select it, but cygwin offers it.

      Cheers, Sören