Deleting remnants of ignored files


#1

Hello,

after syncing a few gigabytes worth, I found myself in the need to filter out portions of the data I don’t really need. However, this leaves me with remnant files that I am not sure how to get rid of, because I am not certain which files are and which aren’t ignored — I have at least 20 folders and many ignores.

My first thought was to delete everything in the index and resync the data but unfortunately this is not an option for me because remote machines won’t be available for some time. My other thought is to scan the audit log and determine which files are ignored, then pipe that to rm or other.

Does anyone have other suggestions on how to do this?

Thank you!


(Jakob Borg) #2

If you mean …syncthing.tmp files that were created while syncing, chill for 24 hours and Syncthing will remove them.


#3

I meant normal files and directories which I put in .stignore after they synced.

Unless I am mistaken and syncthing is supposed to delete these files? I have tried to experiment (?d) but they wouldn’t get removed…


(Jakob Borg) #4

Syncthing will not remove those. Ignoring a file does not mean it gets removed on other devices. (And obviously Syncthing doesn’t delete files on your local computer just because you mention them in the ignore file.)


#5

Apologies if you could not understand what I meant, perhaps I could try explaining in simpler terms:

  • (1) [Global State] on (Device A) consists of ~51000 files and ~5000 directories totalling ~5GB

  • (2) sync of [Global State] from (Device A) to (Device B)

  • (3) on (Device B) a large portion of the data, with relatively complex .stignore rules, is ignored

  • (4) [Local State] on (Device B) now consists of ~4500 files and ~700 directories totalling ~600MB

  • (5) (Device B) has remnant ignored files on the physical disk, totalling > ~2GB

  • (6) (Device A) is not available anymore

There are ~20 such folders for which the above is valid.

I want to remove this extra data (5) on (Device B) which occupies my physical disk. Removing files manually on (Device B) is dangerous because I could make a mistake i.e. change the [Global State].

How to remove (5) on (Device B) without making a mistake?

Is it possible to utilize syncthing, which knows about these ignored files because otherwise it could not construct the [Local State], or to just be incredibly patient?


(Jakob Borg) #6

I can’t think of an easy way to have Syncthing delete the files. I can think of a couple of annoying or inefficient ways - set up another instance and sync a copy of the files (will exclude the ignored ones); set some trace options for the scanner and parse the logs for ignored files, then feed that to a bulk delete tool / script…


#7

Thanks, I think my best option is to write a script that parses the logs and moves the files pending deletion.


#8

Hi analagflow,

I’ve got the same problem that you describe here. Did you manage to create a script which is doing the delete correctly? Would be very cool if you can provide it somewhere that I also can use it.

regards, creature