Overwritten File History / Versioning

Discuss new features and functions
Posts: 45
Joined: 20 May 2008

arrmo

Hi,

Does FreeFileSync allow for overwritten file history / versioning? What I mean
by this is ... if you copy a new file, rather than overwrite the old file,
move the old file to another name first (e.g. in a subfolder there). This
would help with using FreeFileSync for backups.

Perhaps there could be a setting to only version / save old files below a
certain file size, or perhaps only in certain folders.

Thoughts?

Thanks!
User avatar
Site Admin
Posts: 7061
Joined: 9 Dec 2007

Zenju

Maybe deletion setting "versioning" (in sync options) is what you're looking
for? ;)
Posts: 45
Joined: 20 May 2008

arrmo

Hi,

This is close ... :-). It's for files that are to be deleted, not overwritten
- right? Or perhaps I'm misunderstanding. Also, it would be good to have
multiple old versions, in the same directory, except perhaps with an addition
to the filename to show the data ... make sense?

Let me try to give an example. Say we have a file, junk.txt, and it has been
synchronized. Then it changes on one side - rather than just overwriting the
file on the other side, rename junk.txt to junk-2012-04-07-23-12-17.txt, and
the copy junk.txt over.

Does this help explain what I mean?

Thanks!!!
User avatar
Site Admin
Posts: 7061
Joined: 9 Dec 2007

Zenju

It's actually for both deleted an overwritten files. Future possible
improvements of this feature are under discussion:
viewtopic.php?t=1827
[404, Invalid URL: https://sourceforge.net/tracker/?func=detail&aid=3504406&group_id=234430&atid=1093083]
Posts: 45
Joined: 20 May 2008

arrmo

Makes sense - and the discussions seen very reasonable (and on line with what
I was after as well). Thanks!
Posts: 45
Joined: 20 May 2008

arrmo

Hi,

Just following up - any progress on the discussions here? Like one of the
postings, it would be nice to keep x (some number) of copies of old files.

Thanks!
Posts: 45
Joined: 20 May 2008

arrmo

Hi,

My apologies - not meaning to be a pain, but also not sure what the state of
this is. Any chance someone knows?

Thanks!
User avatar
Site Admin
Posts: 7061
Joined: 9 Dec 2007

Zenju

No time line, but I take this as a vote that there is interest in this area.
Posts: 45
Joined: 20 May 2008

arrmo

Sounds good to me - thanks!

Just a thought, but ... as you already know when you're overwriting a file (as
you note Overwrite in the log file) ... why not just rename the old file by
appending the date to it, and then copying the new file over? May be an easy
way to make this work.

Would be nice of course to only keep a specified number of backup files, but
that would be a quick check too.

Just thinking out loud here. Thanks again!
User avatar
Site Admin
Posts: 7061
Joined: 9 Dec 2007

Zenju

Those files would need to be flagged somehow in order to not have them
participate in further synchronization. One would have to come up with a
special tag name like "file.2012-10-12 224211.backup.txt and either implicitly
(too much potential to surprise the user) or explicitly (too cumbersome to
setup) exclude all "*.backup.*" via filters.
Posts: 45
Joined: 20 May 2008

arrmo

Yep - makes sense, and agreed. I was just thinking that if the user asks for
this functionality, they are implicitly agreeing to the filter. Perhaps what
is tagged could be special text that they could enter.

Thanks!

Anonymous

I'll post to this thread what I posted on this similar thread.

I too prefer to have versions of the same file in the same folder instead of
spread across different time-stamped folders. I created a script,
HARDLINKS.CMD that effectively does this by creating hardlinks to the source
files (files in time-stamped folders) to a tree structure. Details in the
header of this script file. HARDLINKS.CMD just needs to be copied to the base
directory where the backups are created (and be on an NTFS volume) and
manaully run:



@goto :BEGIN
=============================================================================================

HardLinks - create hardlinks of files under date/time-named directories created by FreeFileSync revisioning backup
to a single tree structure with file version references

For example, a FreeFileSync Versioning file tree structure like this:

.\BACKUP\REVISIONS
|
+---2012-07-28 151719
| \---3
| TestFile.txt
|
+---2012-07-28 152033
| \---3
| \---c
| TestFile.txt
|
\---2012-07-28 152130
\---3
\---c
TestFile.txt

creates the following tree structure with hardlinks to source files:


.\BACKUP\REVISIONS\_HARDLINKS
|
\---3
| TestFile_2012-07-28 151719.txt
|
\---c
TestFile_2012-07-28 152033.txt
TestFile_2012-07-28 152130.txt


This script should exist in the base directory where FreeFileSync creates date/time-named directories.
Directories processed will be moved to a REVISIONS subdirectory, and hardlinks are created under
REVISIONS\_HARDLINKS. For example:

.\REVISIONS
+---_HARDLINKS
| +---1
| | \---a
| +---2
| | \---b
| \---3
| \---c
|
+---2012-07-28 151106
| \---1
|
+---2012-07-28 151520
| +---1
| | \---a
| \---2
| \---b
|
+---2012-07-28 151719
| \---3
|
+---2012-07-28 152033
| +---1
| | \---a
| +---2
| | \---b
| \---3
| \---c
|
\---2012-07-28 152130
\---3
\---c


- A text file of the tree structure and files can be found in REVISIONS\_Hardlinks\Tree.txt

- A text file containing a list of source files and corresponding hardlinks can be found in REVISIONS\_HardLinks.txt
This file is used by "HARDLINKS.CMD CLEAN" command to clean up unpaired files. Deleting a file from the date/time branch
or _Hardlinks branch does not delete the "paired" file. Running:
HARDLINKS.CMD CLEAN
will process the log file, and for each pair list, if either of the files does not exist
(the link or source file was deleted, but not the other) then the remaining file will be deleted

the REVISIONS\_HardLinks.lst file is updated with the current existing files

File deleted are recorded in REVISIONS\Deleted.lst

The clean process is automatically run at each time you run HARDLINKS.CMD.
To disable the automatic CLEAN process each time HARDLINKS is run, set AUTOCLEAN=N below

You can manually run the CLEAN process by passing CLEAN as a command line parameter:
HARDLINKS CLEAN


==================================================================================================================
:BEGIN
@echo off & setlocal ENABLEDELAYEDEXPANSION

set REVSUBDIR=REVISIONS
set HARDLINKSDIR=_HARDLINKS
set AUTOCLEAN=Y

if NOT EXIST %REVSUBDIR% (
fsutil>nul 2>&1
if errorlevel 1 goto :FSUTILERR
echo Fsutil OK
fsutil fsinfo volumeinfo %~D0 | find /c "NTFS"
if ERRORLEVEL 1 goto :NOTNTFS
md %REVSUBDIR%
)

set PWD=%CD%

if /I "%~1"=="CLEAN" goto :CLEAN

for /F "tokens=*" %%A in ('dir 20*. /ad /b') do (
TITLE Processing %%A
echo.
echo ================================================
echo Processing %%A
call :PROCESS "%%A"
)
tree /A /F %REVSUBDIR%\%HARDLINKSDIR% >%REVSUBDIR%\%HARDLINKSDIR%\Tree.txt
goto :EOF

:PROCESS
set REV=%~1
move "%REV%" %REVSUBDIR%>nul
set RELPATH=%PWD%\%REVSUBDIR%\%REV%
for /f "tokens=*" %%a in ('dir "%REVSUBDIR%\%REV%\*.*" /s /b /a-d') do (
echo %%a
set SRCFILE=%%a
set RELSRCFILE=!SRCFILE:%RELPATH%=!
call :HARDLINK "%%a"
)
if /I "%AUTOCLEAN%"=="Y" goto :CLEAN
if "%~1"=="" pause
goto :EOF

:HARDLINK
set FILEROOT=%~N1
set FILEEXT=%~X1
set RELSRCPATH=!RELSRCFILE:%~NX1=!
set RELSRCPATH=!RELSRCPATH:~1,-1!
if NOT EXIST "%PWD%\%REVSUBDIR%\%HARDLINKSDIR%\!RELSRCPATH!" md "%PWD%\%REVSUBDIR%\%HARDLINKSDIR%\!RELSRCPATH!"
echo.
fsutil hardlink create "%PWD%\%REVSUBDIR%\%HARDLINKSDIR%\!RELSRCPATH!\%FILEROOT%_%REV%%FILEEXT%" "!SRCFILE!"
echo %PWD%\%REVSUBDIR%\%HARDLINKSDIR%\!RELSRCPATH!\%FILEROOT%_%REV%%FILEEXT%^|!SRCFILE! >> %REVSUBDIR%\_HardLinks.lst
goto :EOF

:CLEAN
if EXIST "%TEMP%\_HardLinks.tmp" del "%TEMP%\_HardLinks.tmp"
for /F "tokens=1,2 delims=^|" %%A in (%REVSUBDIR%\_HardLinks.lst) do (
set DEL=
if NOT exist "%%A" set DEL=%%B
if NOT exist "%%B" set DEL=%%A
if NOT "!DEL!"=="" (
echo Deleting !DEL!
DEL "!DEL!"
echo %DATE%: !DEL! >> %REVSUBDIR%\Deleted.lst
) ELSE (
echo %%A^|%%B >> "%TEMP%\_HardLinks.tmp"
)
)
type "%TEMP%\_HardLinks.tmp" > %REVSUBDIR%\_HardLinks.lst
if "%~1"=="" pause
goto :EOF

:FSUTILERR
echo.
fsutil
echo.
pause
goto :EOF

:NOTNTFS
echo.
echo %~D0 is not an NTFS volume
echo.
pause
goto :EOF