Reputation: 75
I am just writing a python code to delete files older than 30 days. While running it, Unfortunately, I gave the wrong path and some of my precious data was deleted.
Can you please tell me how can I restore that data?
This is the function that I used
def remove_file(path):
# removing the file
if not os.remove(path):
# success message
print(f"{path} is removed successfully")
else:
# failure message
print(f"Unable to delete the {path}")
Upvotes: 0
Views: 1229
Reputation: 6630
There are python modules that allow safe deletion like 'send2trash'. You could then recover the files from the recycle bin or trash
Upvotes: 2