How to Retrieve the images deleted using Cleaner

I have deleted a few images using the following code:

‘for idx in cleaner.delete(): cleaner.fns[idx].unlink()’

How to I retrieve the deleted images back to its original folder

Sorry I do not get what your question is :grimacing:
You deleted images and you want to have them back or do you want to get a list of which images were deleted?

Not sure if there is an easy way to get back images you have already deleted from your filesystem. You could do something like this so you can see which files are being deleted and save their names to a text file for reference.

for idx in cleaner.delete():
    print(f'Deleting: {cleaner.fns[idx]}')
    cleaner.fns[idx].unlink()
    with open(path/'cleaned_files.txt','a') as f: f.writelines(str(cleaner.fns[idx]) + "\n")

Or you could make a directory outside of your data folder to hold deleted files and just move the files there rather than actually deleting them:

shutil.move(str(cleaner.fns[idx]), Path('path/to/deleted/directory'))

What to have the deleted images back