Read permissions of fits files removed by fct.CleanFolder

I am using pySiril and the following lines of code in a python script

fct.CleanFolder(processdir,ext_list=[ “.fit”,".seq",".ser"])
number=fct.NumberImages(filesearch, processdir, “ss_” , start=1)

After executing I get a sequence with links named ss_nnnn.fit for all the files in the list filesearch pointing from processdir to the real location of each file. Thats good.

But the unix file permissions of all the real files in the filesearch list is changed from “rw-r–r–” to “-w-------”, so basically read permission is removed.

I found out that this seems to happen in the first line with CleanFolder. When it tries to remove the links in the processdir Folder, it sets the permissions of the real files to write only. Probably it happends in this line of code in addons.py function def remove_file( self,pattern ):
os.chmod(fic, stat.S_IWRITE)

Götz

ping @M27trogonondepomme

I have already corrected a similar bug in Sirilic: I have to postpone the correction in pySiril .
As soon as it’s done, I’ll report it to you

Thank you for fixing it.
Honestly I dont really understand why this function CleanFolder exists anyway, because with standard python libraries deleting files with certain extensions in a folder is very easy, its a one-liner.

The destruction of the symbolics links under windows caused me some problems. Maybe there is an easier way to clean the file.
I pushed the fix on the gitlab