DOS Help

Discussion in 'AutoCAD' started by Michael S. Youla, Feb 17, 2005.

  1. We need to archive all our old projects. I need to create about 300
    directories, one for each project, where I will eventually move all
    related drawings. I don't want to have to set up a bunch of dummy
    directories and then manually rename each directory for 300 directories.
    I thought I might be able to write a lisp routine to automate this - I
    do have a text file with all the project names - maybe I can process
    this as a list and hand each project name as an argument to the DOS
    mkdir command, something akin to this:

    (defun C:createdirectories (/ dircount dirnames r)
    (setq r T)
    (setq dircount 0)
    (setq dirnames (list "2461-Newark" "5611-Presidency Travel"))
    (while r
    (if (= nil (nth dircount dirnames)));;ran out of filename arguments
    (progn
    (setq dirname (strcat "C:/" (nth dircount dirnames)))
    (command "shell" mkdir dirname)
    (setq dircount (+ 1 dircount))
    );;close progn
    (setq r nil);;if's else
    );;close if
    );;close while
    (princ)
    );;close createdirectories

    Unfortunately, it's been many moons since I wrote a DOS batch (.bat)
    routine and I've forgotten all the syntax. I know the routine above does
    not work, specifically the shell part of it, but at least you can see
    what I'm trying to achieve. Thanks for any and all help or suggestions!
    Mike
     
    Michael S. Youla, Feb 17, 2005
    #1
  2. Michael S. Youla

    BillZ Guest

    How about:

    (vl-load-com)

    (foreach directoryname dirnames
    (vl-mkdir (strcat "c:\\" directoryname))
    )

    Bill
     
    BillZ, Feb 17, 2005
    #2
  3. Thank you kindly, sir. Just the ticket. As you can see, I'm still a
    little old-school when it comes to Autolisp, but you CAN teach an old
    dog new tricks.
     
    Michael S. Youla, Feb 17, 2005
    #3
  4. Michael S. Youla

    BillZ Guest

    You're welcome.

    And probably not older than this old dog who just learned most of this stuff. :)

    Bill
     
    BillZ, Feb 17, 2005
    #4
  5. Michael S. Youla

    BTO Guest

    hello,

    (command "shell" "mkdir \"c:\\b\\c\\d\\ew xcw\\wxc f\"")

    to create :

    C:\b\c\d\ew xcw\wxc f\

    with \b\c\d\ew xcw\wxc f\ structure no already exists

    Bruno Toniutti
     
    BTO, Feb 21, 2005
    #5
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.