|
Hi,
I shred a file with the implementation of Peter Gutmann's algorithm in C++
but I can't shred a folder yet.
please instuct.
|
|
|
|
|
MehdiHazrati wrote: but I can't shred a folder yet. Why not? Is the code giving an error?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
The code is resposing well, but it is usefull for file shreding, it uses WriteFile() to overwrite on the file.
For shredding a folder I must search the space of the folder & iterate this procedure for all files, and about the subfolder we need a recursive code to traverse them.
Is there any better solution to wipe a folder of shred a whole drive?
Thanks.
|
|
|
|
|
You cannot 'shred' folders in this way, as they are not writable in the same way that files are.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I thinked that the files of the folder could be deleted in this way and finally the empty folder that is not important can be deleted from the system instructions.
This idea is feasible, but the only concern is about the complexity for the huge folders with various subfolders; it is time consuming.
|
|
|
|
|
MehdiHazrati wrote: it is time consuming. That's why we write programs.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Is there alternative solution to do this?
Specially for wiping a drive
|
|
|
|
|
MehdiHazrati wrote: Specially for wiping a drive Format it, perhaps?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
You can access a volume or physical disk through the CreateFile() [^] function. This would allow you to overwrite all information including the file system tables.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
MehdiHazrati wrote: This idea is feasible, but the only concern is about the complexity for the huge folders with various subfolders; it is time consuming. Have you considered SHFileOperation() or IFileOperation() ? They can recursively delete subfolders.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
From the other responses presumably the following is what you want to do.
1. You want to shred files.
2. You want to shred file information in the directory itself.
For 1 you iterate over files in the directory and recurse through each sub directory and shred each file. You MUST do this. There is no magic solution that would allow you to do it in some other way.
For 2 it is more complex and depends on what you want you think a 'shred' would do. At a minor level you can just rename each file before shredding it. That overwrites the name. For a real shred you would need to
1. Create an API to access the file system at a raw level
2. Parse the file block
3. Shred the relevant file info that was found by step 1. In this case 'shred' includes the same basic methodology employed to shred a file but on a very small scale. You would need to write the shred code yourself.
Note that if you choose to implement the solution above then you MUST back up your hard drive because when you mess up the code you will need to reformat the hard drive. You must also extensively test this feature as well for the same reason. Also account for different file system types (like ssd and usb.)
|
|
|
|
|
thank you for your instructions
but I want to know if there is any way to rewrite the folder area outright and do not delete its files one by one
Regards.
|
|
|
|
|
MehdiHazrati wrote: but I want to know if there is any way to rewrite the folder area outright and
do not delete its files one by one
No.
File systems do not work like that.
|
|
|
|