This is a read-only snapshot of the ComputerCraft forums,
taken in April 2020.
[Request] Format Disk
Started by Rodizipa, 14 February 2012 - 12:23 PMPosted 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 ?
Posted 14 February 2012 - 01:53 PM
What do you mean?
"format <side>" in shell? to completely wipe a disk?
"format <side>" in shell? to completely wipe a disk?
Posted 14 February 2012 - 02:01 PM
Yes this !
Posted 14 February 2012 - 03:05 PM
Access Denied
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
Posted 14 February 2012 - 07:56 PM
Well, I did one for the HDD. Should be easy enough to modify. *goes to work*
Posted 14 February 2012 - 10:16 PM
thanks Advert and Kaleb XD
Posted 16 February 2012 - 02:08 PM
I think it's a good idea to addumm 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.
disk.setLabel(side)
at the end to also clear disk label
Posted 16 February 2012 - 02:23 PM
I think it's a good idea to addumm 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.
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.
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.