-1

I accidentally ran wrong bash script, while trying to move files. All the folders starting like "Lisa" gone and not moved. Below are the rough content of the wrong script.

folder_path = "/media/hdd/folder/"
Lisa = "/media/hdd/folder/folder1/Lisa/"

mv $folder_path Lisa* $Lisa

All the folders starts with Lisa are gone, I checked /media/hdd/folder/folder1/Lisa/ but they are not there. I assume they are deleted but df -h still reports the same free space before I ran the wrong script.

I couldn't find anything using lsof. Are the folders deleted or something else? Any help will be truly appreciated.

closed as unclear what you're asking by jasonwryan, Stephen Rauch, G-Man, countermode, Romeo Ninov Dec 7 '17 at 10:16

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 4
    Post the exact commands run, not an approximation. – jasonwryan Dec 6 '17 at 16:57
  • Have you tried running find? – G-Man Dec 7 '17 at 0:42
1

You have a few issues with your syntax that would cause some problems. In bash (though I'm not sure if that's how you ran this script), the = operator does not perform assignment if there are spaces around it. That is, x=y assigns y to x, but x = y compares x and y. Since you have spaces, I'll assume that both folder_path and Lisa are unset (since no assignment was performed).

If that's the case, on the mv line, $folder_path and $Lisa expanded to an empty string. So, you basically ran this:

mv Lisa*

This expands to everything starting with "Lisa" in your current working directory. Depending on what you have in there, this could do a few different things, including overwriting, moving, and renaming these files.

  • I know, thank you for your explanation. This was supposed to be python script but I accidentally ran as bash script. I want to know, if folders are gone or copied somewhere else, I couldn't figure it out because I have the same exact disk space before I ran the script and /media/hdd/folder/folder1/Lisa/ folder is empty. – user611811 Dec 6 '17 at 17:30
  • In the future, put a #!/usr/bin/env python at the top of your script to make sure your shell will run it as such. As for finding the files, we can't really help you. You could run find . -name "*Lisa*" to find any files/directories containing the string "Lisa" recursively in your current directory. – John Moon Dec 6 '17 at 17:35
  • OK I found them. Let me explain, if I can... find . -iname Lisa* returns nothing. Command ls -larth shows nothing about Lisa, so as ls, but if I type cd Lisa. and hit Tab key cd enters Lisa.z..... folder and everything is there. I don't know why ls and ls -larth doesn't show this Lisa.z... folder I am really curious. – user611811 Dec 6 '17 at 17:42
  • Both find and ls are able to find a folder named "Lisa.z" on my machine without special options. I'm not sure what's wrong with your setup. – John Moon Dec 6 '17 at 18:41

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