Sync file stamp without copying the file

Get help for specific problems
Posts: 2
Joined: 23 Dec 2022

princerock

Is there a way to update file timestamp without copying the file over?

Here is the story. While moving files around to another partition on my NAS, I forgot to preserve the time stamps. Now when I run FFS it flags all these files are newer and want to copy them over to my backup drive. The truth is the time stamps on the back drive are the correct ones and I want to use them to fix the ones on the NAS. There are ~1TB files and if possible, I want to only update the timestamps without copying the files over (since the files are identical).

Thanks!
User avatar
Posts: 3627
Joined: 11 Jun 2019

xCSxXenon

There isn't anyway to do that in FFS, without copying the files over.
There may be a way to do it via CMD or another program
Posts: 945
Joined: 8 May 2006

therube

I use the follow to "re-date" individual (a single) files (typically done through context-menu -> SendTo -> SETTIME).
In my case, I would have an existing file named "abc" that was dated correctly, & I then copy the date from that file to my wanted file. (In my case, the file, abc, is always in the same directory as the file I want to change.)

SETTIME.bat:
@ECHO OFF

ECHO  SETTIME  sets a file's date to the "same" file, named "abc"
ECHO  a sort of more current variation of my old ancient DOS settime program
ECHO.
ECHO  therube 02/20/2015
ECHO.
ECHO  File to change the date of:
ECHO     %1

FOR   %%i in (%1) do  SET   BASENAME=%%~dpiabc
ECHO  reference file (aka "abc"):
ECHO     "%BASENAME%"
ECHO.
ls -l %1
ls -l "%BASENAME%"
ECHO.

PAUSE

touch %1 --reference="%BASENAME%"
:: ls -l %1
c:\bin\dd.exe -1 %1

PAUSE
EXIT
touch, is the UNIX touch command
ls, is the UNIX ls command
dd, is not the UNIX dd command ;-), but rather NDIR, a colored directory list program

touch & ls: are found in coreutils-5.3.0-bin.zip
NDIR: https://derelllicht.com/ndir_info.html

There are other touch's. DIR could be used in place of NDIR...

Maybe something like this, adapted to work with pairs of files could work.
Even if it were simply a batch file with pairs of names (rather then looping through things with FOR) ...
touch z:/file1     --reference="c:/file1"
touch z:/dir/file1 --reference="c:/dir/file1"
touch z:/file2     --reference="c:/file2"
...
(Oh, & there certainly could be gotchas with a method like this - including DST (daylight saving time).)
Posts: 2
Joined: 23 Dec 2022

princerock

Thank you all! I ended up copying all the files - since I noticed my first copy not only updated the time stamps, but also messed up some the EXIFs of the photos which I don't want to lose. Thank you anyway.