From owner-freebsd-questions@freebsd.org Thu Oct 1 11:34:17 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 1DE92425A8B for ; Thu, 1 Oct 2020 11:34:17 +0000 (UTC) (envelope-from jerry@seibercom.net) Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 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 4C29y02cP4z41RW for ; Thu, 1 Oct 2020 11:34:16 +0000 (UTC) (envelope-from jerry@seibercom.net) Received: by mail-qk1-x741.google.com with SMTP id g72so4815910qke.8 for ; Thu, 01 Oct 2020 04:34:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=seibercom.net; s=google; h=date:from:to:subject:message-id:in-reply-to:references:reply-to :organization:mime-version:content-transfer-encoding; bh=4JuLJOJ1GEUBe6ZSvjX24aIoA77rdJViau9alVCKfGg=; b=jhzcwi4nQQnvBxCXf8d46GGJc0rPa0Cs+d+vy7kECA+Qrwg1ylrYIM2HqKH5z5NXm+ WW2sQDMBR/G97iaqrhfC8E0bh/RKHsYYxkTjuEMJfMR3HeusijaWM/5x89ci1bP5wWuA Mc7pt8+pKSfzg7Ac/eO9WBQUiZxLxjk5NGASU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:in-reply-to :references:reply-to:organization:mime-version :content-transfer-encoding; bh=4JuLJOJ1GEUBe6ZSvjX24aIoA77rdJViau9alVCKfGg=; b=sF7utAayT+PIWRTBRW2oO1nkS2Sn8kvMtKZlg+l1xHs7TMMe/31AA1SUyaGig2snVS dzBGNY1uQoqGG90binOtOYVa+3qEXr3kavNTvFIdnHW1oFYqwGOGe/ANHn/aEa1sEUvj SNSfcGxJKtyBjLOzG9A4+XzvMgJU55lqImjs9ngevHfGsgPqvglYvI/G6HbygbMcy2Sh +kg8sAoXaCE+sPhtF+iXzfo+KzI9jSy07kWlLdEJQF1O6DYX9mODM2iwnxWr+enVwW/K mIUbMRnL1XeX5mFxruEve9M9fgbEHYAiXNywPU4AV8SRxUIYnud2jIZlHJt6v1j9tqMr ngwA== X-Gm-Message-State: AOAM533Q9aSC0XVRYrTiJPDSEv/m79E59lTfolrYOHtlgpElGzzxnCJd 2P8RcFqL1LYHQN9zRdzlsWESInZSsDT39g== X-Google-Smtp-Source: ABdhPJzi0RcVQQk5SS9bnkfmsYTppyzjfDTFhbn5PrR4QC6PRBW/e+KxI0U2QNVHPTH23K3neF8Ung== X-Received: by 2002:a37:c4b:: with SMTP id 72mr7038717qkm.176.1601551652232; Thu, 01 Oct 2020 04:27:32 -0700 (PDT) Received: from scorpio.seibercom.net (cpe-174-109-231-236.nc.res.rr.com. [174.109.231.236]) by smtp.gmail.com with ESMTPSA id t64sm5472628qkd.69.2020.10.01.04.27.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Oct 2020 04:27:30 -0700 (PDT) Received: from localhost (hp-envy.seibercom.net [192.168.1.102]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: jerry@seibercom.net) by scorpio.seibercom.net (Postfix) with ESMTPSA id 4C29p93DGyz1jkV for ; Thu, 1 Oct 2020 07:27:29 -0400 (EDT) Date: Thu, 1 Oct 2020 07:27:28 -0400 From: Jerry To: freebsd-questions@freebsd.org Subject: Re: Preserving target file's creation date Message-ID: <20201001072728.000004b6@seibercom.net> In-Reply-To: <202010010424.0914OZ9Y029194@sdf.org> References: <202010010424.0914OZ9Y029194@sdf.org> Reply-To: freebsd-questions@freebsd.org Organization: seibercom.net X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4C29y02cP4z41RW X-Spamd-Bar: ++ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=seibercom.net header.s=google header.b=jhzcwi4n; dmarc=none; spf=pass (mx1.freebsd.org: domain of jerry@seibercom.net designates 2607:f8b0:4864:20::741 as permitted sender) smtp.mailfrom=jerry@seibercom.net X-Spamd-Result: default: False [2.27 / 15.00]; HAS_REPLYTO(0.00)[freebsd-questions@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; TO_DN_NONE(0.00)[]; HAS_ORG_HEADER(0.00)[]; RCVD_COUNT_THREE(0.00)[4]; DKIM_TRACE(0.00)[seibercom.net:+]; NEURAL_HAM_SHORT(-0.52)[-0.517]; RECEIVED_SPAMHAUS_PBL(0.00)[174.109.231.236:received]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; REPLYTO_EQ_TO_ADDR(5.00)[]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.81)[-0.814]; R_DKIM_ALLOW(-0.20)[seibercom.net:s=google]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-0.90)[-0.896]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; DMARC_NA(0.00)[seibercom.net]; RCPT_COUNT_ONE(0.00)[1]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::741:from]; RCVD_TLS_ALL(0.00)[]; GREYLIST(0.00)[pass,body]; MAILMAN_DEST(0.00)[freebsd-questions] X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Oct 2020 11:34:17 -0000 On Wed, 30 Sep 2020 23:24:35 -0500, Scott Bennett via freebsd-questions commented: > On Tue, 29 Sep 2020 13:40:51 +0200 Polytropon >wrote: > >>On Tue, 29 Sep 2020 06:42:18 -0400, Jerry wrote: >>> I am trying to copy/move one file onto another. I need to preserve >>> the creation date of the target file. I see options to preserve the >>> creation date of the source file, but not the target file. Is it >>> possible? >> >>THis is possible - it's important you do not unlink (remove) >>the original file whose creation time you want to preserve. >>I'm not sure if cp does this while overwriting, but you can >>use shell redirection: >> >> $ cat /path/to/souce/file > /path/to/target/file >> >>Only the modification date will be altered. You can verify >>that using "stat filename". >> >>Note that creation time refers to the inode. Even if you >>re-create a file (remove, then create with the same name), >>you'll probably get a different inode, and therefore a >>different creation time. >> >>If you want to preserve modification and access time, you >>can do so using "cp -p"; to alter them after creation, >>use "touch -m" and "touch -a" respectively. >> > There exists another way that allows one to set the ctime. > Offhand, >I don't have any idea how to do it, but restore(8) certainly does. A >"restore -rf /some/backupmadebydump/file" will restore an entire >filesystem with each file's full set of timestamps intact. Recall >that restore(8) rebuilds the filesystem by engaging the filesystem >code, not by writing to a raw device. > Any ideas what restore does to accomplish that? I found that 'touch -r ' works. It involves slightly more work than I had intended, but it gets the job done. -- Jerry