0

I have a project where I need to prove the virtue of a degausser to erase completely all traces of files on a standard HDD. I want to propagate the subject HDD with repetitive information, such as a single word "information".

I am thinking, in this way, I can conduct a search of the degaussed drive very quickly to prove the excellence of the process. As a part of my security requirements, programs like dBan and such are less desirable than a process that will destroy the media's ability to function for storage and any retrieval. The environment the degausser would be used in, should it prove it's integrity, also limits physical destruction of the storage media.

The .bat file I wish to create should contain a recursion that will effect the size of the file being copied so as to incrementally increase the amount of data transfer thereby decreasing the time to fill the drive.


I've used the following and so far the process slows to a crawl after a very (relative) short time. I've experimented with the use of '%' before and after ERRORLEVEL and it seems with the % symbol the program fails early in process. Anyone have any ideas? Here's the script I've been using and the specs of the computer I'm trying this process through:

P4, 1GB Ram, 2.8GHz

echo off 
Rem Setting home folder 
C:
Rem Setting Home folder again 
cd\


:copy repeat

rem Using date and time so it formats the file IT_20130708_Time in hours minutes and milliseconds

set hr=%time:~0,2%
if "%hr:~0,1%" equ " " set hr=0%hr:~1,1%
COPY "IT.txt" "C:\testcopy\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy2\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy3\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy4\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy5\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy6\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy7\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy8\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy9\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"
COPY "IT.txt" "C:\testcopy10\IT_%date:~-4,4%%date:~-10,2%%date:~-7,2%_%hr%%time:~3,2%%time:~6,2%%RANDOM%.txt"


rem if it Does not error GOTO the start aka :copy repeat

IF ERRORLEVEL ==0 GOTO copy repeat

rem end this file if error 

goto end

:end

The intent in the above is to continue copying the next group of files even if there is a failure in the copy operation. Also, the process needs to be accomplished in as short a time as possible. I sincerely appreciate all suggestions, thank you for your time and considerations.

Maxime Chéramy
  • 17,761
  • 8
  • 54
  • 75

1 Answers1

0

One issue you will find (FAT32, myabe NTFS too) is that with large numbers of files in a folder, it takes longer to create new files. You should look at creating a new folder every say 50,000 files.

The size of the file being copied is a factor as small files are very inefficient - so this creates a ~27 MB file to copy with INFORMATION repeated inside it.

There are a finite number of root directory entries in some drive formats so this creates one root folder and then subdirectories inside that.

This might work for you:

@echo off
for /f "delims=" %%a in ('wmic OS Get localdatetime  ^| find "."') do set dt=%%a
set stamp=%dt:~0,8%-%dt:~8,6%

del it.txt 2>nul
echo creating string
for /L %%a in (1,1,500) do call set var=%%var%%INFORMATION
echo creating it.txt file (45 seconds...)
for /L %%a in (1,1,5000) do (set /p =%var%>>IT.TXT <nul)

for /L %%a in (1,1,2000000000) do call :next %%a
pause
goto :EOF

:next
set folder=00000000000%1
set folder=%folder:~-10%
set folder=c:\testcopy\testcopy-%folder%
md  %folder% 2>nul
set c=0
:loop
set /a c=c+1
echo %folder%-%c%
copy it.txt %folder%\IT_%stamp%_%random%%random%%random%%random%.txt >nul
if %c% EQU 50000 goto :EOF
if not errorlevel 1 goto loop
goto :EOF
foxidrive
  • 40,353
  • 10
  • 53
  • 68
  • Most excellent presentation of information and greatly appreciated! I'll put this into our process and report on the outcome. Very impressive and helpful community of people. Thank you for your input – John Williamson Jul 10 '13 at 14:08