From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 172B31382C5 for ; Wed, 5 May 2021 13:34:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 84E43E086F; Wed, 5 May 2021 13:33:58 +0000 (UTC) Received: from pmta31.teksavvy.com (pmta31.teksavvy.com [76.10.157.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 410D1E0839 for ; Wed, 5 May 2021 13:33:58 +0000 (UTC) IronPort-SDR: XSX94DnPCbamtt030lDcwlYJvc72jCRjXILafHuc9405A7WiHhhr18jAb734PKkgiznbULT/IT 9l60ARZfEh+A== IronPort-HdrOrdr: =?us-ascii?q?A9a23=3A3lN9pKq6FynYdAdivrXGxV4aV5sHL9V00z?= =?us-ascii?q?AX/kB9WHVpW+STncy2gbA/3Rj7lD4eVBgb6LS9EYOHRm7R8oMwxIEXM6urUg?= =?us-ascii?q?WOghrOEKhJ64z+zzr8XxDv7+I179YcT4FSAMD9ZGIK7vrSzxK/F78brOWv1I?= =?us-ascii?q?CNqaPgw2x2TQdsApsQkztRLgqACEV5SE1nKPMCZfihz/FKrTahZngbB/7Tbh?= =?us-ascii?q?JuMtTrnNHFmInrZhQLHXccmWyzpAil9aLgFFyg1goeOgk/vosKy3TPkADy+8?= =?us-ascii?q?yY3c2T9x7G22ffq7RQldfxo+EiOOWwi9MYIjiptwCwZI4JYdy/lQ0yydvB1H?= =?us-ascii?q?8a1P335zYpJYBa9m7YdGDdm2qK5yDQlBIVr0LE5XDdq335usD9TC89EKN69P?= =?us-ascii?q?tkWwqc51srudl91K5Rm2aV85BQChzBkk3GlqL1fgAvklDxrWspkOYVgXAaTJ?= =?us-ascii?q?AXb6VJq5cDuExPFpMNGz/79ZAnHOFiANq03ocvTXqKK3bDvmdux9SwXnM8Wh?= =?us-ascii?q?eeK3JywfCo7w=3D=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2EiDgCynZJg/wL192haHgE8DAILFQm?= =?us-ascii?q?BUIMgVmuIeIRQhlOCAR07AYJjY5cVgWgLAQEBAQEBAQEBLQ0BAgQBAQMDgVW?= =?us-ascii?q?CbwSCBiY4EwIEAQEMAQEBBQEBAQEBBgQCAoEAhVANQwEMAYMEgQgBAQEBAQE?= =?us-ascii?q?BAQEBAQEBAQEBAQEBFgINUoEnHHIiQQwKCRuCV4MHqRGBNIEBhGGEdwaBOgG?= =?us-ascii?q?OIkCBCUKBFYYpFwOBIhWGIASCRoEPARMWAoEFXhSRQhGpPYEACoMQgSMHiE+?= =?us-ascii?q?TXJRZkEqhMJl1XYEgfQiDJB8xGQ5Wlk2FZSgvOAIGCgEBAwlXAYIHh2uCRQE?= =?us-ascii?q?B?= X-IPAS-Result: =?us-ascii?q?A2EiDgCynZJg/wL192haHgE8DAILFQmBUIMgVmuIeIRQh?= =?us-ascii?q?lOCAR07AYJjY5cVgWgLAQEBAQEBAQEBLQ0BAgQBAQMDgVWCbwSCBiY4EwIEA?= =?us-ascii?q?QEMAQEBBQEBAQEBBgQCAoEAhVANQwEMAYMEgQgBAQEBAQEBAQEBAQEBAQEBA?= =?us-ascii?q?QEBFgINUoEnHHIiQQwKCRuCV4MHqRGBNIEBhGGEdwaBOgGOIkCBCUKBFYYpF?= =?us-ascii?q?wOBIhWGIASCRoEPARMWAoEFXhSRQhGpPYEACoMQgSMHiE+TXJRZkEqhMJl1X?= =?us-ascii?q?YEgfQiDJB8xGQ5Wlk2FZSgvOAIGCgEBAwlXAYIHh2uCRQEB?= X-IronPort-AV: E=Sophos;i="5.82,275,1613451600"; d="scan'208";a="160746233" Received: from 104-247-245-2.cpe.teksavvy.com (HELO waltdnes.org) ([104.247.245.2]) by smtp13.teksavvy.com with SMTP; 05 May 2021 09:33:56 -0400 Received: by waltdnes.org (sSMTP sendmail emulation); Wed, 05 May 2021 09:33:58 -0400 From: "Walter Dnes" Date: Wed, 5 May 2021 09:33:58 -0400 To: Gentoo Users List Subject: [gentoo-user] [OT] tar exclude syntax tip Message-ID: Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Archives-Salt: 27b6e58e-0837-4388-ac0d-df6ef661070e X-Archives-Hash: 174c2807c9ca588d5d9d11f6c5ff1445 tar version #################################################### tar (GNU tar) 1.34 Copyright (C) 2021 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later . This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by John Gilmore and Jay Fenlason. #################################################### I'm passing on this solution to help others avoid my frustration and wasted time. If you've done "RTFM" on tar, you'll find out that "TFM" is broken or out-of-date or whatever, re: "--exclude=PATTERN". I'm fighting the urge to turn this into a rant. Here's my situation... I either log in as root or "su -" and then "cd /home". I want to tar up /home/waltdnes, and transfer it to another machine. While I'm at it, I want to exlude directory /home/waltdnes/.cache/ and all *.xz files in directory /home/waltdnes/pm/ The "--exclude=" never worked. After much hair pulling, I was ready to give up on the exclude, and simply transfer all the unnecessary garbage. Then "I asked Mr. Google". It seems that I wasn't the only person running into problems. After some searching, I finally found a syntax that works... #################################################### #!/bin/bash export GZIP=-9 tar cvzf wd.tgz --exclude ".cache/*" --exclude "pm/*.xz" waltdnes #################################################### Notes... 1) This is obviously not in line with the man page. Specifically, "--exclude" is followed by one space, not an equals sign. 2) ***THERE MUST BE EXACTLY ONE SPACE BETWEEN EACH WORD*** 3) All directories and/or files to exclude must be listed as relative paths to the directory being tarred, i.e. last parameter on the command line. 4) I don't know the maximum line-length, which would limit the number of --exclude entries. In those cases, I wonder if "--exclude-from=FILE" works as "--exclude-from FILE". -- Walter Dnes I don't run "desktop environments"; I run useful applications