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

Format (Update 3) - TNT for your hard drive!

Started by Fetchetch, 02 May 2015 - 11:56 PM
Fetchetch #1
Posted 03 May 2015 - 01:56 AM
Format (Update 3)

TNT for your hard drive



Format is a utility/program for ComputerCraft which, well is TNT for your hard drive (o/w deletes all files found by the program)

Features
Spoiler
  • Has a "Are you sure?" feature so if you have anything that you need on the disk you have a second chance
  • Very user friendly
  • Resets the label of the computer
  • Deletes hidden files! (e.g. you have a file named ".thisisahiddenfilethatnobodywillcareaboutbecauseithasnothinginitandiwillnevertouchitagain". it will be deleted)
  • Lists deleted files when deleted
  • Unloads all api's when starting the deletion process
  • Now doesn't end with a error message! (Thank you Atenefyr) .
  • Now has arguments so you can delete certain folders/disks (You need atleast one)

Screenies
SpoilerBefore:

(yes i took my time to make 10 garbage files)

After:

(When it says Access Denied that means its done. (its trying to delete the rom folder.))
It shouldn't do that now.

Download:

Simply put "pastebin run QABTzv2M [folder]" and it will run and delete the folder ([folder] without the brackets and folder being what folder you want to delete)

O/w pastebin id: QABTzv2M
Edited on 03 May 2015 - 05:07 PM
biggest yikes #2
Posted 03 May 2015 - 02:36 PM
You could just blacklist the /rom directory, so that it doesn't try to delete it. I haven't tested this, but it should not delete rom: http://pastebin.com/jJnc1xkc
Edited on 03 May 2015 - 12:36 PM
Fetchetch #3
Posted 03 May 2015 - 02:51 PM
You could just blacklist the /rom directory, so that it doesn't try to delete it. I haven't tested this, but it should not delete rom: http://pastebin.com/jJnc1xkc

I'll add that code in right now. Thanks for the info.
biggest yikes #4
Posted 03 May 2015 - 03:55 PM
You could just blacklist the /rom directory, so that it doesn't try to delete it. I haven't tested this, but it should not delete rom: http://pastebin.com/jJnc1xkc

I'll add that code in right now. Thanks for the info.
fs.delete("*") would've done the same thing without the blacklist
Edited on 03 May 2015 - 01:59 PM
Fetchetch #5
Posted 03 May 2015 - 04:52 PM
You could just blacklist the /rom directory, so that it doesn't try to delete it. I haven't tested this, but it should not delete rom: http://pastebin.com/jJnc1xkc

I'll add that code in right now. Thanks for the info.
fs.delete("*") would've done the same thing without the blacklist

Yeah that is true. Putting that in is basically just rm * with confirmation (which is what i had before).
MKlegoman357 #6
Posted 03 May 2015 - 04:58 PM
You should be checking if the file you are trying to delete is not read only instead of making a blacklist, ther could be a number of disk drives connected to the computer and you don't really want to be adding them all to a blacklist which would fail.
Edited on 03 May 2015 - 03:00 PM
Geforce Fan #7
Posted 03 May 2015 - 05:04 PM
A misleading title, it sounded like it would apply a different format to the drive, however, it just erases the drive. You should call it 'wipe' instead.
Edited on 03 May 2015 - 03:04 PM
flaghacker #8
Posted 03 May 2015 - 06:00 PM
A misleading title, it sounded like it would apply a different format to the drive, however, it just erases the drive. You should call it 'wipe' instead.

Most people use the format stuff in windows for wiping a USB stick, hence the confusion.

The subtitle wasn't too misleading, I assume :P/>.
Fetchetch #9
Posted 03 May 2015 - 06:46 PM
A misleading title, it sounded like it would apply a different format to the drive, however, it just erases the drive. You should call it 'wipe' instead.

Most people use the format stuff in windows for wiping a USB stick, hence the confusion.

The subtitle wasn't too misleading, I assume :P/>.

Well yeah thats what i has aiming for… I did think i would get this though hence every program i found with format in it was to "beautify" code or something else like that.

You should be checking if the file you are trying to delete is not read only instead of making a blacklist, ther could be a number of disk drives connected to the computer and you don't really want to be adding them all to a blacklist which would fail.
So what your saying is to add the disks to the blacklist? Or see if they are read only? Im confused…
Edited on 03 May 2015 - 04:47 PM
MKlegoman357 #10
Posted 03 May 2015 - 07:32 PM
So what your saying is to add the disks to the blacklist? Or see if they are read only? Im confused…

You should be checking if the file you are trying to delete is not read only instead of making a blacklist…
flaghacker #11
Posted 03 May 2015 - 08:25 PM

if v ~= "rom" or v ~= fs.isReadOnly() then

The first part is obsolete, as the rom folder is readOnly. This program already exists in computercraft, it is called rm.
Exerro #12
Posted 03 May 2015 - 08:44 PM

v ~= fs.readOnly()
Really?

not fs.readOnly( v )
… is what you're looking for.
biggest yikes #13
Posted 03 May 2015 - 09:10 PM
This program already exists in computercraft, it is called rm.
Yeah that is true. Putting that in is basically just rm * with confirmation (which is what i had before).
iAd4m #14
Posted 06 May 2015 - 02:24 AM
What is the point in this? I can just do delete * if I want to remove all the files