0

So I was working on a python script that allows me to use a 7 segment display via scripting. I added functionality to read a byte from a string, presets for certain numbers, etc. It took me a solid 4 hours to make. I decided to move this file using:

mv display/display.py display

I forgot to add the file extension at the end. I may have forgot a certain part of the command, however this is roughly what I put in. When I went to check the file, it wasn't there, all I could find was /display. I used nano to check it, to find out that my entire morning's work was reduced to: /display is a directory!. I am 99% sure that this is what used to be my display.py file. Is there any way to recover my data, or do I have to start over?

  • 5
    The command you give should do nothing, with a warning if you’re using a typical Linux distribution (“mv: 'display/display.py' and 'display/display.py' are the same file”). Are you sure your file isn’t still there in display/display.py? – Stephen Kitt Jan 1 at 21:53
  • 1
    If you move a file to a name of an existing directory, the file will be moved into that directory. – Kusalananda Jan 1 at 21:58
  • mv xy ... without noting the full path/name of xy should do nothing (beside error reporting). There must be some other reason for this... – jerch Jan 1 at 22:18
  • You should always be able to find the exact command you typed in the shell history, so you can figure what it did. – Paul_Pedant Jan 1 at 23:10
-1

As it turns out, I didn't remember my command correctly. It actually got renamed to a different name entirely. I checked a file of the same name I gave it, and sure enough, it has my code in it.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.