LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Did I just lose my mp3s with a bad mv command? (https://www.linuxquestions.org/questions/linux-newbie-8/did-i-just-lose-my-mp3s-with-a-bad-mv-command-56080/)

int0x80 04-21-2003 08:09 AM

Did I just lose my mp3s with a bad mv command?
 
I just woke up, and was checking out some mp3s that got downloaded last night. There were some that had the filename format of ## song title.mp3 and others that had the filename format of ##-artist-song_title.mp3 (no spaces). So I wanted to move the ones with spaces to a separate directory. But I wasn't paying attention and issued the following command:
Code:

mv ./* *.mp3 albums/magnum_force
and I completely forgot to put an escape character to signify that I wanted an actual space between the asterisks. Now I can't find any of the mp3s that were in the directory, and a sub-directory is gone as well. Is there any way to recover these? Or are they gone for good?

The fs is ext3 (if that has any significance).

trickykid 04-21-2003 08:47 AM

Have you tried performing a search for them first? Maybe with a find or locate command?

int0x80 04-21-2003 09:55 AM

Quote:

Originally posted by trickykid

Have you tried performing a search for them first? Maybe with a find or locate command?

Yes sir. Actually one of the first things I did was run updatedb then locate mp3 |less My findings so far indicate that file recovery seems possible with ext2, but not ext3. The following is something I found at http://batleth.sapienti-sat.org/proj.../ext3-faq.html

Quote:

Q: How can I recover (undelete) deleted files from my ext3 partition?

Actually, you can't! This is what one of the developers, Andreas Dilger, said about it:

In order to ensure that ext3 can safely resume an unlink after a crash, it actually zeros out the block pointers in the inode, whereas ext2 just marks these blocks as unused in the block bitmaps and marks the inode as "deleted" and leaves the block pointers alone.

Your only hope is to "grep" for parts of your files that have been deleted and hope for the best.


wapcaplet 04-21-2003 08:38 PM

I don't know what command you executed there, but it looks like it did some nastiness :)

You may want to add a line like:

alias mv mv -i

to your .bashrc or .profile or whatnot, to cause mv to prompt you for stuff like that in the future.

Boy, right here is a great answer for all those who ask "why not run as root all the time?"

int0x80 04-21-2003 10:52 PM

Quote:

Originally posted by wapcaplet

I don't know what command you executed there, but it looks like it did some nastiness :)

You may want to add a line like:

alias mv mv -i

to your .bashrc or .profile or whatnot, to cause mv to prompt you for stuff like that in the future.

Boy, right here is a great answer for all those who ask "why not run as root all the time?"

Actually what happened was the mp3s and sub-directories that disappeared got moved to albums/magnum_force (luckily). Much thanks goes to realnowhereman over at DevShed. He put in a great effort to find out what really happened.

Also, I already went into .bashrc and made an alias for mv but included the --verbose option ;)


All times are GMT -5. The time now is 10:20 AM.