EvilZone

General Tech => Operating System => : DerpyTurtle September 09, 2015, 03:27:51 AM

: mv command accidental merge ...can it be undone?
: DerpyTurtle September 09, 2015, 03:27:51 AM
So I went to move a bunch of files from my main machine to my external drive and I ended up using this command

:
# mv *.mp3 /foler1/folder2/folder3/filename
and when the command completed I realized that I made a mistake because the directory I was trying to move these files to was actually one step higher so the command should have been this

:
# mv *.mp3 /folder1/folder/2/folder3/

My question to you is there any way to remedy this? Any way to go back and retrieve those files after they were all accidentally merged into a single file instead of a directory..? I have been living in Windows land for the past few years because of work so my skills are a little rusty. Any help is much appreciated[/code]
: Re: mv command accidental merge ...can it be undone?
: 0E 800 September 09, 2015, 05:46:39 AM
filename is not a directory. i dont think it would let you complete the command.

trick question?
: Re: mv command accidental merge ...can it be undone?
: Kulverstukas September 09, 2015, 07:23:07 AM
Even if that let you merge files, I have no idea how it'd be possible to unmerge them. However tho, every file name has a beginning and an end which is marked by file type header. You could make a raw byte parsing tool which would read bytes from that merged file and write blocks of MP3 data into separate files :P
: Re: mv command accidental merge ...can it be undone?
: gray-fox September 09, 2015, 08:07:20 AM
It's possible, even tho I would say "merged" isn't exactly right word. If you had only one .mp3 file in your current directory. Then you just basically did,
:
mv file1.mp3 file2
and file2's content gets "overwritten" by file1.mp3's content. But if you had multiple .mp3's as I would imagine because the use of wildcard, then it should complain about file2 not being directory as OE 800 said.

edit: Just realized op said bunch of files, so trick question+1?

Also @DerpyTurtle, did you somehow examine the output file to see that it actually changed. E.g.
:
$ file filename #if target file wasn't originally mp3
$ stat filename