I am new to both perl and this forum. Please forgive any possible etiquette issues as I do not intend to be rude. I'm also nowhere near solid with programming languages but am working toward that.
My goal is to create a perl script that will write ZEROS to a text file until the file is around 2GB in size. I have the following code that works for a single file:
use strict; use warnings; my $filename = 'recipe.txt'; open(my $fh, '>', $filename) or die "Could not open file 'recipe.txt'" +; print $fh "0" x 2147483648; close $fh; print "done\n";
The thing is, I need it to then create a new textfile, append a 7-digit number to the name (to account for large storage volumes), and also fill that with zeros as with the first text file.
I can do the math as needed for each drive/volume in order to know how many files will need to be created. I could use help with the perl code to create text files, then write to them until the amount of space has been overwritten by these next text files.
My goal is to overwrite a hard drive after a client project completes in order to secure their privacy. Sure, I could do this via a linux command prompt, but I often have some idle/under-used Windows machines, so I was hoping to use perl to accomplish this. I rarely have an extra linux box available at present. Plus, if I can get this working via perl, then I should be able to utilize it on any Unix/Linux machines I get down the line, even if a few tweaks are needed. Plus, I want to learn Perl and find ways to use it to my advantage.
I suspect that this will involve variables for the name creation (at least the incremental numbering). If I could tell it how many files to create (edit the script before running) that would work I think.
Thanks in advance for any assistance you can provide.
In reply to Create text files recursively and write ZEROS within them all - data overwriting purposes by panicbuttonsec
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |