My pen-drive has no write-protect switch like the good old floppies. I wanted to make it protected so that those worms and viruses dont infect it when i put it in other computers.
So, to make it write-protected, i made a
java program that generates a dummy file. We can see the empty space of the pen drive and create a dummy of that size and put it in the pen drive.
Minor problem with code - You fill the drive with a dummy file. Even after doing that there is some small space left in the drive. I have to run the code again and make a dummy of that size. Then, the pen drive is completely filled.
Can anyone add these features for me ?
(1) Detect pen-drive empty space and generate a file of the exact size in one attempt.
(2) make it GUI based.
Anything else you can think of (issues, suggestions etc) ?
Here is the code, it is console based :