Creating Folders and Moving Files

is there a way to create a folder on the hard drive and then set it in the program that whatever i create, will go into that folder???

Comments

  • Yes. You can manage files and directories (folders) either by BASIC's limited commands (depending on which BASIC language you're using), or go through DOS with the SHELL command.

    To make a folder:
    MKDIR "root:fullpath"

    where root is the "root" directory - usually, C.
    fullpath is the complete location where you want the folder to be. So if you wanted to make a folder on the C drive called foldernw, you would do:

    MKDIR "C:foldernw"

    When you make a new file with an OPEN command, it's created in the currently active directory. You can switch which directory you're in by the CHDIR command:

    CHDIR "root:fullpath"

    If your dialect of BASIC doesn't have these commands (although it should), you can use the SHELL to give the corresponding commands to DOS.

    SHELL "MKDIR root:fullpath" to make folders
    and
    SHELL "CD root:fullpath" to change directories, the equivalent of basic's CHDIR.


    : is there a way to create a folder on the hard drive and then set it in the program that whatever i create, will go into that folder???
    :


  • : is there a way to create a folder on the hard drive and then set it in the program that whatever i create, will go into that folder???
    :
    In SheerPower 4GL (available here for free), creating folders and subfolders is implied when opening a file with a path:

    open #1: name 'c:myfiles
    ewplaceafile.txt', access output

    This will create all of the necessary folders and subfolders.

    http://www.ttinet.com/sheerpower
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories