How to GET a "Folder Name"...

How to GET a "Folder Name"...

Anonymous
Not applicable
905 Views
3 Replies
Message 1 of 4

How to GET a "Folder Name"...

Anonymous
Not applicable

hello everyone:

 

I need some help...

how to get  a folder name that is different depending of the REVIT VERSION.... (see underline folder name below)

 

 

(setq OldPath (getvar "dwgprefix"))                                              ;;;  I get             "U:\\100000\\elec\\"

(setq len (strlen OldPath))                                                             ;;;  I get               "15"                                             

(setq FullPath2 (substr OldPath 1 (- len 1)))                                   ;;; I get                "U:\\100000\\mech"

(setq split_path (dos_splitpath FullPath2))                                    ;;;  I get                ("U:" "\\100000\\" "mech" "") break path in 4 pieces

(setq GetDrive (nth 0 split_path))                                                 ;;;  I get                 "U:"

(setq GetPNumber (nth 1 split_path))                                          ;; ;  I get                "\\100000\\"

 

 

(setq DirList (dos_dirtree (strcat GetDrive GetPNumber)))

 

DirList return a list of subfolders inside the folder "\\100000\\"...

("U:\\100000\\" "U:\\100000\\elec\\" "U:\\100000\\mech\\" "U:\\100000\\pl\\"

"U:\\100000\\Revit 2016\\" "U:\\100000\\Revit 2016\\!CAD-LINKS\\"

"U:\\100000\\Telecom\\" "U:\\100000\\x-refs\\")

 

I need to get the name of the "REVIT 2016" (is not always the same name) and make sure the \!CAD-LINKS\\" exist.

 

Any help is appreciate..

 

DC

 

 

 

0 Likes
Accepted solutions (1)
906 Views
3 Replies
Replies (3)
Message 2 of 4

paullimapa
Mentor
Mentor
Accepted solution

Try this to check for Revit folder:

(foreach itm DirList (if (wcmatch itm "*Revit*")(setq RvtList (append (list itm) RvtList))))

!RvtList will return:

("U:\\100000\\Revit 2016\\!CAD-LINKS\\" "U:\\100000\\Revit 2016\\")

 

Then to check for !CAD-LINKS folder:

(foreach itm RvtList (if (wcmatch itm "*!CAD-LINKS*")(setq CADList (append (list itm) CADList))))

 

!CADList will return:

("U:\\100000\\Revit 2016\\!CAD-LINKS\\")

 

or nil if it does not exist

 

 

Area Object Link | Attribute Modifier | Dwg Setup | Feet-Inch Calculator
Layer Apps | List on Steroids | VP Zoom Scales | Exchange App Store


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 3 of 4

Anonymous
Not applicable

thank you so much Paul... you got it!!

0 Likes
Message 4 of 4

paullimapa
Mentor
Mentor
0 Likes