Reverse Contents of File

August 14, 2011 at 12:03:29
Specs: Windows 7
Hi. I really don't have any experience with this.
How would I write a batch file to reverse the contents of each file (byte by byte) in a folder? Or even just a batch file to reverse the bytes of a single file?
It sounds like it'd be simple enough to do. I've tried googling it but I couldn't find it.

See More: Reverse Contents of File

Report •


#1
August 15, 2011 at 16:06:31
What is your purpose in doing this?

Please explain what you mean by reverse the contents, does this mean make the last line the first line etc, mirror image the file contents or what?


Please come back & tell us if your problem is resolved.


Report •

#2
August 17, 2011 at 08:15:31
Long story short. Friend and I in a prank war. His latest prank was making some of my files unreadable/playable. He'd only reverse what he'd did if I surrendered, but that's not an option of course. Finally got him to tell me what he did so I can try to undo it myself, and he said he reversed file byte by byte.
I assume this means mirror image the file contents?

Anyway, I found this Hex Editor Frhed, that has the option of "reverse bytes". I'm at work now so I can't try it out but hopefully this will work. Unfortunately, I'd have to go file by file, which is why I was hoping someone could direct me to a batch file that could process an entire folder's worth of files. I'm thinking this isn't hard to do or else my friend wouldn't have done it.


Report •

#3
August 17, 2011 at 08:24:18
You really shouldn't let "friends" loose on your computer. Come to think of it, how do we know that you are not the "friend" wanting to do this to someone else?

Anyway, I don't think you can do it with a batch file but it would take 5 minutes to knock up a C program to do it.


Report •

Related Solutions

#4
August 17, 2011 at 08:37:55
It's just harmless fun. He didn't mess with any important documents. Mainly videos, music and some other stuff.
But you have a point there. I guess you can't know if I'm the "friend" who wants to do this.

I wasn't sure how easy it would be able to program but I guess I can try to do one in C++. Time to put that intro course knowledge into use.


Report •

#5
August 17, 2011 at 22:12:42
If you ever have success with writing a program to do this please do NOT post it on this or any other forum, you never know what nut will pick it up and create mayhem with it.

Yes, It can be done in batch scripting quite easily but I won't be showing you how.


Please come back & tell us if your problem is resolved.


Report •

#6
August 18, 2011 at 08:08:13
ijack: You really shouldn't let "friends" loose on your computer.
I know a few people who had such a war. Peanut butter was involved.
That said, I was involved in a few wars back in the day. Peanut butter was not involved.

congeal: I wasn't sure how easy it would be able to program but I guess I can try to do one in C++.
C++ is a good choice. Really, any middle to high level general purpose language should be able to do what you want. Just don't expect much outside help with the attack.

As for the request itself, you'd have to get past the suspicion surrounding you. As it stands, you might get pointers if something goes wrong, but you probably won't get a working script / program.

How To Ask Questions The Smart Way


Report •

#7
August 18, 2011 at 10:57:22
It seems that was not what he did to my files. Tried messing around with them using the hex editor and couldn't return any of them to their original state. Guess I won't have to bother trying to write up a program.

Hm, what nowl.


Report •

#8
August 18, 2011 at 11:25:45
Did he change the extension of the files?
Did he "flip" the bits?
Does he really know what he did?
Most files have header or identification information in them, and you should be able to view this data in your hex editor.

How To Ask Questions The Smart Way


Report •

Ask Question