From owner-freebsd-questions@freebsd.org Sat Feb 15 13:41:33 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 878D823B520 for ; Sat, 15 Feb 2020 13:41:33 +0000 (UTC) (envelope-from michaelsprivate@gmail.com) Received: from mail-qv1-xf32.google.com (mail-qv1-xf32.google.com [IPv6:2607:f8b0:4864:20::f32]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 48KWcX4SkHz4GFM for ; Sat, 15 Feb 2020 13:41:32 +0000 (UTC) (envelope-from michaelsprivate@gmail.com) Received: by mail-qv1-xf32.google.com with SMTP id y8so5648354qvk.6 for ; Sat, 15 Feb 2020 05:41:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aOKAu5/r7q/31/4xStJbruHheTsjmYVJBvw5hLqWcZg=; b=ksUPF8Wqf/IoRKaBUQHpfgA9eI7cSoHlEw+PmAefyT3tBU8oOZCCdbq59wnn9IsUzW H7Ojm6P/50zHcaOcA17uLyn3Lf/Xf+gXVdr8u0Wc4IZfeMYyTvJ8sDF+ExlD6cA10roU Nac/Zm/EUIVc9e9WWn91isiUVcAR84RRtncnwSaHXcNP2EfStJmRyMBT8uYZhdOHCD8r oKx9KPy6briEerURef+IO5d3BjEB0c2rnnFwQhPUkC+a+5T5kSlsP5E0YSnHHTwr1NNz 74hO1+ZV0v/EDFWKo6mnrdSXNkS7wjEGnq2MGkVevxbPRUc0Z/XWw7L9wBOKH2nkiGzX qdCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=aOKAu5/r7q/31/4xStJbruHheTsjmYVJBvw5hLqWcZg=; b=efK1/Z8bkCyMxv2hUqK0FFliRs2StpHLW7S6c6QZKjq+mX7UtqVafExTlpuWFh+YY1 JniI8UkytQe50ZTELjZfemJATIiCMYFk4KpI3p01a9hoTWoLHMOSj0AtTdi45mP+fpjJ CurDJiBChESComTXIANTta3uOsIMINrHAHv2C0+g0o9yeq9j5auQ+uBQKGvTtJ4mhzob 3oy6jEfL9y8cxRR3ElDy7FE3TYZVz5tynLIlzih3P3kQNnG6IV1RPqqFEztCHzy9PqS6 oeEZjo285swMXkGIWINpYn37ZLZSNL4mdqpQsUYFEd4qkDMynjnNlaoiJXwpAVNB3d1f kEGw== X-Gm-Message-State: APjAAAXbr0E7pv6HxqhFr+CDpwv52k/qx0L6JjkbWQXsysdEJ+m26A1D e7nwbPpAvJSRO1TydPT5PhOF3A+lDDjRYO5ZAPE= X-Google-Smtp-Source: APXvYqxNWgYkdPJpGfwhrIVbNC8+z3wAoPiz1uElkorOvaIQhzkhchwZu7xUFdcl3AHBMo9veCHpj1r1PE2ibOagEFI= X-Received: by 2002:a05:6214:287:: with SMTP id l7mr6380908qvv.142.1581774086333; Sat, 15 Feb 2020 05:41:26 -0800 (PST) MIME-Version: 1.0 References: <24af365c-bfab-b5ac-72e3-675b0450b75f@cloudzeeland.nl> <792c5f22-5851-7419-f9a1-fa40df265f1c@denninger.net> In-Reply-To: <792c5f22-5851-7419-f9a1-fa40df265f1c@denninger.net> From: Michael Schuster Date: Sat, 15 Feb 2020 14:41:14 +0100 Message-ID: Subject: Re: Removal script To: Karl Denninger Cc: freeBSD Mailing List X-Rspamd-Queue-Id: 48KWcX4SkHz4GFM X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=ksUPF8Wq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of michaelsprivate@gmail.com designates 2607:f8b0:4864:20::f32 as permitted sender) smtp.mailfrom=michaelsprivate@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; IP_SCORE(0.00)[ipnet: 2607:f8b0::/32(-1.90), asn: 15169(-1.68), country: US(-0.05)]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Feb 2020 13:41:33 -0000 I would suggest find /mysources - type d -name nonsense ... HTH Michael On Sat, Feb 15, 2020, 14:36 Karl Denninger wrote: > > On 2/15/2020 07:31, Jos Chrispijn wrote: > > I am looking for a way to remove a nested subdirectory in a directory. > > > > Example: > > directory /mysources has a certain number of subdirectories which > > contain subdirectory 'nonsense' in various subdirectories, which > > contain also subdirectory 'nonsense', etc. > > > > What I would like to do is that the script removes all 'nonsense' > > folders in the base /mysources. > > Can you pls tell me how I can do that savest? Thanks! > > > > /jos > > Well, there's no completely "safe" way that might not nuke something you > don't intend, but.... > > find . -type d -name 'nonsense' -exec rm -rf {} \; > > Starts in the current directory, walks the tree, anything that is a > directory and has the name "nonsense" is "rm -rf'd". > > Just don't be wrong about any of those directories being or having in > them something you don't want nuked. "rm -rf" does exactly what you > tell it to and it's entirely possible to really hose yourself with it > (e.g. "rm -rf /" will do exactly what you think it might.) > > -- > Karl Denninger > karl@denninger.net > /The Market Ticker/ > /[S/MIME encrypted email preferred]/ >