dot in filename issue with new backup policy

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
uwestoehr
Posts: 1658
Joined: Sun Jan 27, 2019 3:21 am

dot in filename issue with new backup policy

Postby uwestoehr » Sun Mar 15, 2020 9:55 pm

The new option to use the FCbak extension for backup files has a small but important issue:

It leads to filenames with 2 dots, e.g. "Filename.20200315-215654.FCBak". Some security and anti-malware programs (only on Windows I guess) will therefore trigger such files as potentially harmful, especially since also the FCBak extension is not known to those programs.

To overcome this, could the dot please be replaced by e.g. a hyphen: "Filename-20200315-215654.FCBak"
User avatar
Kunda1
Posts: 7687
Joined: Thu Jan 05, 2017 9:03 pm

Re: dot in filename issue with new backup policy

Postby Kunda1 » Sun Mar 15, 2020 10:57 pm

uwestoehr wrote:
Sun Mar 15, 2020 9:55 pm
To overcome this, could the dot please be replaced by e.g. a hyphen: "Filename-20200315-215654.FCBak"
Let the dev know in the relevant forum thread. Should be in the PR

Edit:
plgarcia wrote::bell:
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
uwestoehr
Posts: 1658
Joined: Sun Jan 27, 2019 3:21 am

Re: dot in filename issue with new backup policy

Postby uwestoehr » Sun Mar 15, 2020 11:09 pm

Kunda1 wrote:
Sun Mar 15, 2020 10:57 pm
Let the dev know in the relevant forum thread. Should be in the PR
The point is that merged PRs don't appear in the normal forum view anymore.

However, I found the PR: https://forum.freecadweb.org/viewtopic. ... 35#p377135
and added there a note to continue here visibly for all developers.
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: dot in filename issue with new backup policy

Postby plgarcia » Fri Mar 20, 2020 10:13 am

In fact what we can do is simply remove the . between the name and the date.
If somebody wants a - it can put it in the format what could be the default.

Tell me what you prefer either force a - instead of a . or move the separator in the format.
Regards
User avatar
uwestoehr
Posts: 1658
Joined: Sun Jan 27, 2019 3:21 am

Re: dot in filename issue with new backup policy

Postby uwestoehr » Fri Mar 20, 2020 11:24 am

plgarcia wrote:
Fri Mar 20, 2020 10:13 am
Tell me what you prefer either force a - instead of a .
Yes, this simple change would solve the issue.
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: dot in filename issue with new backup policy

Postby plgarcia » Fri Mar 20, 2020 12:43 pm

OK I continue the analysis this week-end. To keep the number of archives we list the documents starting with the same name. I have to think a way to avoid confusions of the archives in this case. I often add a -1 -2 to a project name when I want to keep a version.

I take that this week-end.
Regards
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: dot in filename issue with new backup policy

Postby plgarcia » Fri Mar 20, 2020 12:46 pm

New proposal
And what if we put the - between the date and the FCBak extension.
Eventially swap both FCBak-<the date>

Like that the part of the name before the . is alway what is to be compared in Backup policy.
User avatar
uwestoehr
Posts: 1658
Joined: Sun Jan 27, 2019 3:21 am

Re: dot in filename issue with new backup policy

Postby uwestoehr » Fri Mar 20, 2020 4:53 pm

plgarcia wrote:
Fri Mar 20, 2020 12:46 pm
Like that the part of the name before the . is alway what is to be compared in Backup policy.
I am happy with every solution as long as these 2 points are fulfilled:

- the filename has the suffix ".FCbak"
- there is only one dot in the filename and this the one before "FCbak"
onekk
Posts: 381
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: dot in filename issue with new backup policy

Postby onekk » Fri Mar 20, 2020 6:24 pm

why not a format date-name.FCbak

with date like YYYYMMDD?

On old UNIX trick to have them ordered by date.

In this manner almost every filesystem will list them in chronological order.

Regards

Carlo D.
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: dot in filename issue with new backup policy

Postby plgarcia » Fri Mar 20, 2020 9:11 pm

Your way would mix the files of the different projects saved in the same folder. That is why the name followed by the date is a better way sorting.

The backup policy is base on the date of the file so that whatever the logic of the naming of the backup they can be properly ordered to delete the eldest ones if too many.
But to identify the files I must be able to relate the backups to the project files and therefore to distinguish between the name of the file and the added part. The first . is the way, and it is working very fine.

If we just replace the . by - imagine 2 projects.
project.FCStd
project-2.FCStd

They backups would have the form
project-202003-182325.FCBak
project-2-202003-182325.FCBak
The first - cannot be the criteria if we do not want to confuse between the archives of the 2 projects.

That is why I would propose to add the date in the extension.
project.202003-182325-FCBak
or
project.FCBak-202003-182325

to find always the name before the first .


Regards