Author Topic: create a folder on the fly  (Read 4459 times)

0 Members and 1 Guest are viewing this topic.

rude dog

  • Guest
create a folder on the fly
« on: January 24, 2004, 01:54:32 AM »
(defun c:LOG ()
(setq LOG_LAY (open "lay-INFO.TXT" "w"))
(write-line "Layer Names" LOG_LAY)
)
(close LOG_LAY)
(PRINC)

After that newbie challenge I skipped about 5 chapters to attempt an answer for the read-line function...now I find my self extremely curious about this sec. of the book....this prog. (attached) adds the txt file "lay-INFO.TXT" in my acad2000 folder which I really dont care for....is there a way to create a folder for it on the fly and place it else where?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
create a folder on the fly
« Reply #1 on: January 24, 2004, 05:04:56 AM »
Have a look at :

(vl-file-directory-p [ filename ])

(vl-mkdir [directoryname])


Regards
kwb
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Mark

  • Custom Title
  • Seagull
  • Posts: 28762
create a folder on the fly
« Reply #2 on: January 24, 2004, 05:43:20 AM »
Yes you can create a dir like Kerry mentioned or you can simply add the path to an existing dir by including it. Like so;
Code: [Select]
(setq LOG_LAY (open "c:\\foldername\\lay-INFO.TXT" "w"))
TheSwamp.org  (serving the CAD community since 2003)

rude dog

  • Guest
create a folder on the fly
« Reply #3 on: January 26, 2004, 07:55:58 AM »
thanks this will help me organize better.

ronjonp

  • Needs a day job
  • Posts: 7529
create a folder on the fly
« Reply #4 on: January 26, 2004, 02:58:01 PM »
Not really related but ...... here's a cool batch file for right click in explorer. It created a folder with the current date and whatever preceding text you specify.


@Echo Off
@Echo Creating A Folder With Today's Date
Set CURRDATE=%TEMP%\CURRDATE.TMP
DATE /T > %CURRDATE%
Set PARSEARG="eol=; tokens=1,2,3,4* delims=/, "
For /F %PARSEARG% %%i in (%CURRDATE%) Do SET YYYYMMDD=%%j-%%k-%%l
MKDIR "From "%YYYYMMDD%

 :D

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
create a folder on the fly
« Reply #5 on: January 26, 2004, 04:14:19 PM »
Hmm.... Ya know I used to make lots and lots of applications with batch, but I haven't used it in some time ... except to snag those pdf files and flash files that you can't save from the web site directly. Of course I also use one to clean up all of the bak files before I backup all of my drawings.

This is the code I use for grabbing PDF files. You can also use it for getting just about any other file type from your temp internet files.
Code: [Select]
@echo off
For /F "tokens=1* delims= " %%f in ('dir /a /s /b "%USERPROFILE%\LOCALS~1\TEMPOR~1\CONTENT.IE5\*.pdf"') do copy "%%f %%g" C:\PDF

Of course this requires that the folder C:\PDF exists, to make it grab other file types, simply change the occurences of PDF to the extension you want to grab and make sure the folder exists where you want to put them.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie