Re: how to select files not in a list
From: Stephane CHAZELAS (this.address_at_is.invalid)
Date: 04/29/04
- Next message: zzapper: "Re: FTP Client which will FTP only one file type say HTML"
- Previous message: Stephane CHAZELAS: "Re: Wildcards in expanded variables"
- In reply to: Carli Fuchs: "how to select files not in a list"
- Next in thread: William Park: "Re: how to select files not in a list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 29 Apr 2004 19:37:45 +0100
2004-04-28, 08:24(-07), Carli Fuchs:
> I have two lists, one list holds actual users, another holds a listing of
> home directories. I want to remove the directories that are not in the
> actual users list. I have tried diff, comm, and uniq, but I cannot get just
> a list of directories of people who are not on the actual users list. Am I
> approaching this task wrong? My approach is to list all folders (they are
> named the same as the accountholder), and compare the folder names to the
> list of people who are current account holders. I was thinking that would
> give me a list of people who had folders but did not have accounts, and then
> I can delete those folders. Is there another way to do this?
zsh/bash/ksh:
set -f
cd /home
IFS="
"
echo rm -rf -- $(comm -1 -3 <(cut -d: -f1 /etc/passwd|sort) <(ls))
Remove "echo" when you're OK.
-- Stéphane ["Stephane.Chazelas" at "free.fr"]
- Next message: zzapper: "Re: FTP Client which will FTP only one file type say HTML"
- Previous message: Stephane CHAZELAS: "Re: Wildcards in expanded variables"
- In reply to: Carli Fuchs: "how to select files not in a list"
- Next in thread: William Park: "Re: how to select files not in a list"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|