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

[Request] Format Disk

Started by Rodizipa, 14 February 2012 - 12:23 PM
Rodizipa #1
Posted 14 February 2012 - 01:23 PM
an, for the next version of CC, can the developers add a disk format ? or the users of forum make a program for this ?
Advert #2
Posted 14 February 2012 - 01:53 PM
What do you mean?
"format <side>" in shell? to completely wipe a disk?
Rodizipa #3
Posted 14 February 2012 - 02:01 PM
Yes this !
FuzzyPurp #4
Posted 14 February 2012 - 03:05 PM
Access Denied
Advert #5
Posted 14 February 2012 - 03:15 PM
umm in shell type delete disk/

I think that results in "Access denied"

You could use something like this (untested, no checking):

sDisk = {...}

for _, sFile in pairs(fs.list(sDisk[1])) do
fs.delete(sDisk[1] .. "/" .. sFile)
end
-- Done?

save as "format" or whatever, then type:
format disk/

It should clean the directory (it shouldn't have to be recursive, since only disk drives are protected)

Edit: fixed and tested, should work now.
Edited on 14 February 2012 - 02:21 PM
Kaleb702 #6
Posted 14 February 2012 - 07:56 PM
Well, I did one for the HDD. Should be easy enough to modify. *goes to work*
Rodizipa #7
Posted 14 February 2012 - 10:16 PM
thanks Advert and Kaleb XD
EvgEniy #8
Posted 16 February 2012 - 02:08 PM
umm in shell type delete disk/

I think that results in "Access denied"

You could use something like this (untested, no checking):

sDisk = {...}

for _, sFile in pairs(fs.list(sDisk[1])) do
fs.delete(sDisk[1] .. "/" .. sFile)
end
-- Done?

save as "format" or whatever, then type:
format disk/

It should clean the directory (it shouldn't have to be recursive, since only disk drives are protected)

Edit: fixed and tested, should work now.
I think it's a good idea to add
disk.setLabel(side)
at the end to also clear disk label
Advert #9
Posted 16 February 2012 - 02:23 PM
umm in shell type delete disk/

I think that results in "Access denied"

You could use something like this (untested, no checking):

sDisk = {...}

for _, sFile in pairs(fs.list(sDisk[1])) do
fs.delete(sDisk[1] .. "/" .. sFile)
end
-- Done?

save as "format" or whatever, then type:
format disk/

It should clean the directory (it shouldn't have to be recursive, since only disk drives are protected)

Edit: fixed and tested, should work now.
I think it's a good idea to add
disk.setLabel(side)
at the end to also clear disk label

Yeah, that would be a good addition, but you might not always want to clear the label.
arongy #10
Posted 18 February 2012 - 08:36 AM
Yeah, that would be a good addition, but you might not always want to clear the label.

In that case you would add an argurment boolean to check if it does or not.