
-----------------------------------
Finaltank
Mon Oct 10, 2005 11:23 am

Dir.Get --&gt; Stringing the info
-----------------------------------
% The "DirectoryListing" program.
setscreen ("text")
var streamNumber : int
var fileName : string
streamNumber := Dir.Open (".")
assert streamNumber > 0
loop
    fileName := Dir.Get (streamNumber)
    exit when fileName = ""
    put fileName
end loop
Dir.Close (streamNumber)


Wherever you save that it gives you output

How would I turn that into a string?
EX: The output of my program is


.
..
testfile.t
turing_files.ini
testfile2.t


How would I return code to look for lets say a file?

like I want the file to analyze the files in the directory, and find the files and delete them. I want to create my own antivirus, since I find turing deletes files like an antivirus when the user cant.

How would I get it to wipe a directory?

-----------------------------------
Cervantes
Mon Oct 10, 2005 1:37 pm

Re: Dir.Get --&gt; Stringing the info
-----------------------------------

like I want the file to analyze the files in the directory, and find the files and delete them. I want to create my own antivirus, since I find turing deletes files like an antivirus when the user cant.

How would I get it to wipe a directory?
An antivirus?  Or a virus?  Seems like you want to make a virus.  Mind you, a program that wipes out a directory is not a virus, it's a malicous program.  

In computer security technology, a virus is a self-replicating program that spreads by inserting copies of itself into other executable code or documents made by crackers

Anyways, instead of putting the filename on the screen, save it to an array. and then delete the files in the array.

% The "DirectoryListing" program.
setscreen ("text")
var streamNumber : int
var fileName : string
streamNumber := Dir.Open (".")
assert streamNumber > 0
var files : flexible array 1 .. 0 of string
loop
    new files, upper (files) + 1
    files (upper (files)) := Dir.Get (streamNumber)
    exit when files (upper (files)) = ""
end loop
Dir.Close (streamNumber) 
for i : 1 .. upper (files)
    File.Delete ("./" + files (i))
end for

Hopefully that's bug free.  Can't be sure though.

-----------------------------------
TokenHerbz
Mon Oct 10, 2005 1:42 pm


-----------------------------------
i dont think this web site should be promoting virus makers/ hurrasers...

-----------------------------------
Finaltank
Mon Oct 10, 2005 3:33 pm


-----------------------------------
No what it does is it searches your C drive for certain files. If it finds them it deletes them.

Ex: Find RunDXFor.dll
There is no such file called that, but if you run my thing, and it finds it, you delete it.

Just my program doesnt really work with viruses that disguise as files (ex: kernell32.dll)

EDIT: Now I need to make it do it for folders lol...
Ill try and use your info there to teach myself, though upper is new, got a guide or something I can read? Like in the tutorial area?

-----------------------------------
Cervantes
Mon Oct 10, 2005 8:05 pm


-----------------------------------
 got a guide or something I can read? Like in the tutorial area?
Why, yes, I do!  [url=http://www.compsci.ca/v2/viewtopic.php?t=8808]link
Edit:Oh yeah, look at the arrays section.  Andy's tutorial mentions it briefly.  Also, check the help file.  F10.
