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

creating directory's

Started by cheekycharlie101, 03 September 2012 - 03:20 PM
cheekycharlie101 #1
Posted 03 September 2012 - 05:20 PM
ok so i would like to make a program that makes a directory. but i have been searching the wiki and havent been able to work it out. i guess it will probaly involve functions and the line fs.makeDir(""). anyway, i need it so like you type directorycreate (directory name)

the program is obviously going to be called directorycreate but im not sure about how to go about doing it. please help

-Charles
MysticT #2
Posted 03 September 2012 - 05:26 PM
There's already a program for that, it's mkdir. If you still want to do it, take a look at it's code (inside /rom/programs).
jay5476 #3
Posted 03 September 2012 - 05:27 PM
this will probly do a the trick but its basic


term.clear()
term.setCursorPos(1, 1)
write("New Directory Name: ")
sName = read()
fs.makeDir( sName )
cheekycharlie101 #4
Posted 03 September 2012 - 05:42 PM
thank you both guys :D/>/>
DisFunqTional #5
Posted 04 September 2012 - 04:36 AM
you can also use the shell api, it has shell.run(), you would make a directory with this using mkdir like this .. shell.run( "mkdir", "folder" ), or "disk/folder"… this would make a directory called folder.