Weeks ago, I used Python to write a txt file (xyz.txt) onto disk, then manually added some content to the file (using a text editor). Today I accidently rerun the code block so all contents I added are missing. Is it possible to recover the file?
The code I use is as follows:
with open("xyz.txt", "w") as file:
for line in data_list:
file.write(f"{line}\n")
No timemachine backup. No icloud backup. I tried DiskDrill but it can not find the previous version that contained my manually added contents.
I am working on a Macbook pro laptop.
strings, like here, but starting from the block device instead of an image. Until you find what you seek, you want to stop writing to the device. And you certainly don't wantstringsto write to the device, because it may find its own output and "loop". Thengrep -A … -B …orgrep -n …, using a string you remember was in the lost content. – Kamil Maciorowski Nov 19 '22 at 08:07stringsas an answer to the other question, so that one is complete and can still serve as canonical. Maybe I will do it in few hours. – Kamil Maciorowski Nov 19 '22 at 12:27