From owner-freebsd-questions@freebsd.org Mon Oct 17 15:40:27 2016 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A6607C156A6 for ; Mon, 17 Oct 2016 15:40:27 +0000 (UTC) (envelope-from demelier.david@gmail.com) Received: from mail-qk0-x22a.google.com (mail-qk0-x22a.google.com [IPv6:2607:f8b0:400d:c09::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DBF47E8 for ; Mon, 17 Oct 2016 15:40:27 +0000 (UTC) (envelope-from demelier.david@gmail.com) Received: by mail-qk0-x22a.google.com with SMTP id n189so241356294qke.0 for ; Mon, 17 Oct 2016 08:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=2gt0f7o9TVfJssEdkxXNA6/ZlnN5pCYyhv64ahxCMIw=; b=sDnX9r4OP4uoyUPmjo7vvaKvGdOwgqAektcGv9PFkoIV2bZjiMsMBlb9DwlPewtWbK LPLEc+77o0tMChJrgzXKg/wvWxbHuZhPFHasCdYvWllvtS9VZBVsllOH9ebS1BwkQ8Zv wY2//Jg4ns8APDXb/lrgKu8PbU5vSfykHwL/jfCNr/oXido77HJAVUoIX56+gIlyxWwy QEy9jd4moSrsdbgsrtSp85Q++Sgt8R75Uhm+vkdtxxs1FM2GB5M2ISp4KNzE3Iro4cA2 yvYnt3JIKxL6O3LUME99eb/fYHdNP9s8FA7o2LUqZBeEuZTBeeX4B3xN/yzHx6w62cTb UqzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=2gt0f7o9TVfJssEdkxXNA6/ZlnN5pCYyhv64ahxCMIw=; b=bp9Y7it3Gp8Sz/rE2hQDnyawuSGJve0z/6FkbMygtzcbu6BkJJzunaIYiyVhlXyulg c/qq8l4JdhyLrqtJk8GasMr72HHFQ2Gr0BRG+wB7ictk8X5pj4Av4rMj8YOZtxcZRuXn CSw5smaUpJP2xpo0ZF3YOvUzQ6Qtk0E2QquneOtOgM89yyZN+iVGTP1jyu2PZHXN0gYl sLCRCU1SX9ue7fdzIY+ws30B2V6VdtmfK3xSiMD+HXPmjv5aCvGeRuY3GiHXy5YRJST6 04V/NWQg2PWDS7BDEihOZA8jNUV6ZR72hSUcVFyC6HWDYQqu6S6NBZPDw5EKP/bWym3k /G1Q== X-Gm-Message-State: AA6/9RlySkRKjHcMJuHD5sATHbCbLeowypEMVqiPdjuaiYhcvWOG+haeuDc09FwcP9q8yFdRd9LN/tjtEJrN5g== X-Received: by 10.55.15.167 with SMTP id 39mr27791628qkp.234.1476718826480; Mon, 17 Oct 2016 08:40:26 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.170.149 with HTTP; Mon, 17 Oct 2016 08:40:25 -0700 (PDT) Received: by 10.12.170.149 with HTTP; Mon, 17 Oct 2016 08:40:25 -0700 (PDT) In-Reply-To: References: From: David Demelier Date: Mon, 17 Oct 2016 17:40:25 +0200 Message-ID: Subject: Re: A request for cp flag To: Manish Jain Cc: freebsd-questions Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 17 Oct 2016 15:40:27 -0000 Le 17 oct. 2016 4:50 PM, "Manish Jain" a =C3=A9crit : > I occasionally face a problem while copying contents with cp. The -R > flag of cp takes the source name as this : If the source_file ends in a > /, the contents of the directory are copied rather than the directory > itself. This is by design, rsync does the same. > Now, I am pretty sure, there must be good reasons for cp to behave in > that manner by default. But it also creates significant opportunities > for things to go wrong the way shell completion of directory names works. > > Could it considered a valid request that an extra flag (perhaps -r) be > implemented that does the reverse : copy out src rather than src/* ? This adds complexity, we will then need to explain carefully the difference between the two options and then remember which of -r or -R copy the directory itself and not the content. And you can still get in trouble if typing too fast and accidentally write cp -r instead of -R. --=20 David Demelier