Finaltank wrote:
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.
Wikipedia wrote:
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.
code: |
% 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.