vl-mkdir Permissions

vl-mkdir Permissions

dave.mahoney
Contributor Contributor
1,007 Views
6 Replies
Message 1 of 7

vl-mkdir Permissions

dave.mahoney
Contributor
Contributor

When I use (vl-mkdir "filepath") the folder that is created is read-only.  How do I make it read/write?

 

setq filepath (getvar "dwgprefix"));gets drawing path
(setq exportfolder "\\2010_version\\")
(setq exportpath (strcat filepath exportfolder))
(vl-mkdir exportpath)

 

Regards

 

Dave

0 Likes
1,008 Views
6 Replies
Replies (6)
Message 2 of 7

Ranjit_Singh
Advisor
Advisor

Did you try creating a file in that folder? The read only property of a folder is ignore by windows.

0 Likes
Message 3 of 7

dave.mahoney
Contributor
Contributor

Yes, that is where I run into problems as I get "Cannot write to directory:

 

(defun c:aecexport ()
(setq d (rtos (getvar "CDATE") 2 6)
;get the date and time and convert to text

yr (substr d 1 4)
;extract the year

mo (substr d 5 2)
;extract the month

day (substr d 7 2)
;extract the day

);setq
(setvar "filedia" 0)
(setq filepath (getvar "dwgprefix"));gets drawing path
; sets export path
(if (findfile (strcat filepath "\\2010_version\\"))
(setq export_path (strcat filepath "\\2010_version\\"));; if true
(vl-mkdir (setq export_path (strcat filepath "\\2010_version\\")));; if not
)
(setq export_dwg_name (getvar "dwgname")); sets drawing name
(princ (strcat export_Path "\n"))
(SETVAR "CMDECHO" 0) ; suppress command line
(command "-aecexporttoautocad" 
"f"; Format
"2010"; Year
"b" ; Bind xrefs - Yes/No
"y" ; Yes Bind
"t" ; Bind type=Bind/Insert
"b" ; Bind
"s" (strcat "-" yr "-" mo "-" day) ; YYYY-MM-DD
"" (strcat export_path export_dwg_name)) ; drawing path and name
(setvar "filedia" 1)
(setvar "CMDECHO" 1) ; turn command line on
(princ)
)  

Command: AECEXPORT
C:\Users\Dave.Mahoney\Documents\\2010_version\
File format: 2010
Bind xrefs: Yes
Bind type: Bind
Filename prefix: ACAD-
Filename suffix: -2016-10-25
Cannot write to directory:

 

The folder is created in the correct location but cannot be written to.

The path that is highlighted might have something to do with it but I am not sure why.

 

Regards

 

Dave

0 Likes
Message 4 of 7

patrick_35
Collaborator
Collaborator

Hi

And with Scripting.FileSystemObject ?

 

For example

(setq fso (vlax-create-object "Scripting.FileSystemObject"))
(setq dir (vlax-invoke fso 'createfolder (strcat (getvar "dwgprefix") "\\2010_version")))
(vlax-put dir 'Attributes 16)
(vlax-release-object fso)

@+

Message 5 of 7

dave.mahoney
Contributor
Contributor

I get the following with the folder being created

 

Error: bad argument type: stringp #<VLA-OBJECT IFolder 0000000048050978>

0 Likes
Message 6 of 7

john.uhden
Mentor
Mentor
Nice. Worked for me in 2002.

John F. Uhden

0 Likes
Message 7 of 7

patrick_35
Collaborator
Collaborator

Hi

 

The error occurs when the directory created or modication directory attributes ?
But I will look for more rights issues on the server.

 

@ +

0 Likes