Re: BASH file processing help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 17 Nov 2003, Mobeen Azhar wrote:

> I have been trying to complete a simple (for me on the WinBlows

I rather doubt it's simple on Windows.

> of "For all files in a given directory, delete files with the same name
> from this other directory".  I tried using find with exec but that

DIR1=/some/path
DIR2=/some/other/path
for file in "${DIR1}/*"; do 
    FILENAME="${DIR2}/$(basename "$file")"
    [ -e "$FILENAME" ] && rm "$FILENAME"
done

-- 
Todd's "Customer Disservice Hall of Shame" currently contains:
    AT&T) 
	Honoring the "checks" they send out to entice you to switch
	long-distance providers is apparently optional.
    eFax) 
	Receive (not send) 20 pages of *unsolicited* faxes, and lose
	your account. 
    AOL) 
	Broken mail servers which ignore the RFCs. Who's surprised?



-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux