This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
PiiNGPooNG's profile picture

Simple Stripmine / Clear a floppy disk

Started by PiiNGPooNG, 02 March 2013 - 08:38 AM
PiiNGPooNG #1
Posted 02 March 2013 - 09:38 AM
First I want to know how to make a simple Stripmine which digs 2 blocks high and 1 block thick.

Like if you type in the turtle:
turtle.dig()
turtle.forward()
turtle.digUp()

And this for 50blocks.

Second question: Can I clear a floppy?
If yes. How can i clear it?
Lyqyd #2
Posted 02 March 2013 - 10:55 AM
Split into new topic.


for i = 1, 50 do
  turtle.dig()
  turtle.forward()
  turtle.digUp()
end

Delete the contents of the floppy and clear its label.
PiiNGPooNG #3
Posted 02 March 2013 - 11:19 AM
But how do I delete the contents?
Bubba #4
Posted 02 March 2013 - 11:25 AM
But how do I delete the contents?

From the shell, type "cd /disk" to navigate to the disk directory. Type "ls" to see all the files, and type "rm [program]" to remove programs you want. Type label to see all arguments (including a way to unlabel a disk).

In a program, an easy way to delete the entire contents of a directory would be to do something like the following:

for i,v in pairs(fs.list("/disk")) do
  fs.delete(fs.combine("/disk/", v))
end 
Lyqyd #5
Posted 02 March 2013 - 11:26 AM
Manually, you can use the delete program (or its alias rm); automatically, you could use fs.list and fs.delete:


for _, file in pairs(fs.list("/disk")) do
  fs.delete("/disk/"..file)
end