0

Using powershell, I moved a bunch of files into a directory that doesn't exist.

move *.png E:\directory\that\does\not\exist

It's a very trivial human error. But instead of having an error thrown back to me by PS. it actually accomplished the task by not creating the directory that yet had to exist (move command does not do that right?). But by leaving me a file that got the same directory name and with a size that combines the size of all files moved inside it. Here's a screenshot:

Screenshot

So is it possible to recover any data from that file?

OS: Windows 10 17763.1 (v1809)

1
  • Hm. This sounds like something the old cmd copy command could have done. It shouldn't have happened with PowerShell's Move-Item.
    – Bob
    Oct 6, 2018 at 6:27

1 Answer 1

0

I'm not entirely sure how you achieved this with that command, given that it's thrown an error after moving (renaming) the first file on my tests. Are you sure that's the size of all files?

That said, assuming this is simple concatenation of the files, there's a fairly simple solution given that PNG files have a known header of 89 50 4E 47 0D 0A 1A 0A. You just need to split on those bytes.

If you can get access to a Linux machine, there's a few ways you can do this. I would recommend the Python csplitb, which includes an example command for the PNG header:

 csplitb.py --prefix photo --suffix .png --number 4 89504e47 block-file.raw

Being Python, I expect this to work on Windows too.

3
  • After spending sometime messing with stuff and reading through HEX data of that 'pictures' file. what seemed to happen was that it moved only 1 file with PNG extension (it was probably the only PNG available in there). it was renamed to 'pictures' and left it extension less. The command I typed was move *.png E:\pictures . If it was E:\pictures.png . then the file would still be shown a PNG image in explorer.exe. after adding ".png" at the end I was able to view it again. Why had I not thought of that earlier?
    – Plast0000
    Oct 6, 2018 at 15:42
  • @Plast0000 That does match what Move-Item would do, yes. I was thrown off by your guess that the destination was the same size as multiple files :P
    – Bob
    Oct 7, 2018 at 12:11
  • Well it seemed too big compared to the average size of PNG images I usually deal with so I just assumed that heh.
    – Plast0000
    Oct 7, 2018 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .