Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Set difference between sets of files
- X-seq: zsh-users 14089
- From: Itai Fiat <itai.fiat@xxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Set difference between sets of files
- Date: Tue, 5 May 2009 19:36:49 +0300
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=hGc+ZWwTbnSyWmodaGHvZ0FaLCjV7B+PniD6WPYRgrk=; b=L1mqa/TVb4bgjKeMKXCcW5LwbH+QHK8qSVG1vy5JSa4cLvItlVLlj2CDwylkM6JFXO ZWYng1u3ovJq1H0nW2Rcon6g/yGjZYKCo7kYNSa9o5kvJw2rhjEWsXuT2xxtEcuZNmgs pLa+YN8CLd7BTyB8qAtDuu1+KNYWD3tlGkjbI=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=g6BO+qMLZ/4bH/Ox4F1Xb/RIHT/uoO2IWy5iHeVdds+L8gZUGtMlzmFhfffXuY74Q1 BRIo8CPUxCXOYT1n0ukd45uyYFyAeerb+MwTeda6UyGrsrSIzXWqsWS2OyVKgCww+K0I zJJV7RLOfPIHjZWeXCmnmVTeIayJ25KABXAh8=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
Hi all,
I'm pretty new to Zsh. I have a question:
I would like to compute the set difference between two sets of files - that is,
obtain a list of files found in one set and not in the other.
For instance, say I have two directories - master/ and backup/ - containing
(mostly) identical files. I would like to remove from backup/ all files which
have been removed from master/. I would like to achieve this by doing something
like this:
cd master/
MASTER_FILES=(**/*(.))
cd ../backup
BACKUP_FILES=(**/*(.))
TO_REMOVE=<set difference between BACKUP_FILES and MASTER_FILES>
rm -f $TO_REMOVE
I know that this can be done by writing both sets to temporary files, sorting
them, and using the standard Unix command "comm", but is there an elegant way
to do this from within Zsh?
Sincerely yours,
Itai
--
All nationalists have the power of not seeing resemblances between
similar sets of facts.
- George Orwell, "Notes on Nationalism"
Messages sorted by:
Reverse Date,
Date,
Thread,
Author