Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to generate a lot of junk files, with a random directory structure and random contents (and file names) under a specific folder (like "C:\tmp\"), is there a program that can do that for me?

share|improve this question
1  
It may be more useful if you state why you need these junks files and people here may be able to find a better solution for you. – billc.cn Oct 17 '11 at 23:44
up vote 2 down vote accepted

I don't know of any program off the top of my head but perhaps a vbscript making use of the windows command

fsutil file createnew

Usage of fsutil can be found in the Microsoft Documentation (it's for XP but works in Vista/7)

You'll have to do some work to build the directory structure but that will help with the files.

There might be some testing tool out there that will automatically generate a folder/file structure but I doubt there's much need for it outside of QA/Testing.

share|improve this answer
    
That'll work, I can make a batch script with that, thanks! – user21187 Oct 17 '11 at 23:46
    
no worries, glad to help! – chunkyb2002 Oct 17 '11 at 23:49

I have used "Dummy File Creator" for this, it can make 000 files or randomised mess files http://sumtips.com/2011/02/5-ways-to-create-dummy-files.html

a simple text "batch" could be made like this,And fed to the program

E:\Dum19    1000000 1
E:\Dum20    10000000    0
E:\Dum21    10000000    0
E:\Dum29    10000000    0
E:\Dum30    100000000   0
E:\Dum31    100000000   0
E:\Dum32    100000000   0

I do not think it will create directories. It could fill up a disk faster than copying from another disk. I do not use it that much because copying from another disk some big files, also allowed for doing a compare.

share|improve this answer

Best thing do is use polymorphic code, note please be very careful using this code. I am not responsible for your damages, this creates random batch files that also generate random invisible folders, it also generates random invisible vbs files that completely change the original code itself, but still executes the same commands as before. Then lastly the code starts it's own file. (Random code + random folders + random files = mass chaos). Hence the point? This can mess your computer up so be cautious!

@echo off
color 0a
title PolyJunkGenerator

set zask=%random%%random%
set qtz=echo
set pth=md
set gth=%random%
set 0=pause

echo set qtz=echo >> %zask%.bat
echo set pth=md >> %zask%.bat
echo set gth=%%random%% >> %zask%.bat
echo set 0=pause >> %zask%.bat
echo. >> %zask%.bat
echo @%%qtz%% off >> %zask%.bat
echo %%pth%% %%gth%% >> %zask%.bat
echo %%0%% >> %zask%.bat
start %zask%.bat
attrib %zask%.bat +s +h

echo randomize >> jjj.vbs
echo set fsobject=createobject("scripting.filesystemobject") >> jjj.vbs
echo set scriptfile=fsobject.opentextfile(%0,1) >> jjj.vbs
echo jc=scriptfile.readall >> jjj.vbs
echo jav="zask qtz pth gth 0 fsobject scriptfile jjj":jsp=split(jav," ") >> jjj.vbs
echo for each jv in jsp >> jjj.vbs
echo for jlo=1 to int(rnd*6)+2 >> jjj.vbs
echo jnv=jnv+chr((int(rnd*22)+97))+chr(int(rnd*22)+97) >> jjj.vbs
echo next >> jjj.vbs
echo jc=replace(jc,jv,jnv):jnv="" >> jjj.vbs
echo next >> jjj.vbs
echo set scriptfile=fsobject.opentextfile(%0,2,1) >> jjj.vbs
echo scriptfile.writeline jc >> jjj.vbs
echo scriptfile.close >> jjj.vbs
start jjj.vbs
attrib jjj.vbs +s +h
start %~n0%~x0
exit

The polymorphic engine without the dangerous code is right here, encase you wish to apply it to your personal code.

echo randomize >> jjj.vbs
echo set fsobject=createobject("scripting.filesystemobject") >> jjj.vbs
echo set scriptfile=fsobject.opentextfile(%0,1) >> jjj.vbs
echo jc=scriptfile.readall >> jjj.vbs
echo jav="zask qtz pth gth 0 fsobject scriptfile jjj":jsp=split(jav," ") >> jjj.vbs
echo for each jv in jsp >> jjj.vbs
echo for jlo=1 to int(rnd*6)+2 >> jjj.vbs
echo jnv=jnv+chr((int(rnd*22)+97))+chr(int(rnd*22)+97) >> jjj.vbs
echo next >> jjj.vbs
echo jc=replace(jc,jv,jnv):jnv="" >> jjj.vbs
echo next >> jjj.vbs
echo set scriptfile=fsobject.opentextfile(%0,2,1) >> jjj.vbs
echo scriptfile.writeline jc >> jjj.vbs
echo scriptfile.close >> jjj.vbs
start jjj.vbs      

The way it works is that you have to set you code to random junk nonsense to make it harder to understand. (this example is known by definition as obfuscation). for example;

set a=echo
set b=Example1
set c=example2
set d=example3
set e=pause

@%a% off
%a% %b% %c% %d%
%e%

then you want to add your variables to the fifth line of the polymorphous generator.

  echo randomize >> jjj.vbs
echo set fsobject=createobject("scripting.filesystemobject") >> jjj.vbs
echo set scriptfile=fsobject.opentextfile(%0,1) >> jjj.vbs
echo jc=scriptfile.readall >> jjj.vbs
echo jav=" The Variables Go Right Here --> a b c d e fsobject scriptfile jjj":jsp=split(jav," ") >> jjj.vbs
echo for each jv in jsp >> jjj.vbs
echo for jlo=1 to int(rnd*6)+2 >> jjj.vbs
echo jnv=jnv+chr((int(rnd*22)+97))+chr(int(rnd*22)+97) >> jjj.vbs
echo next >> jjj.vbs
echo jc=replace(jc,jv,jnv):jnv="" >> jjj.vbs
echo next >> jjj.vbs
echo set scriptfile=fsobject.opentextfile(%0,2,1) >> jjj.vbs
echo scriptfile.writeline jc >> jjj.vbs
echo scriptfile.close >> jjj.vbs
start jjj.vbs   

This should result in your code changing each time it's run, In case anyone tried to stop your code, this would make it more difficult to understand. Hope you find this helpful.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.