cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Determine if a Windows folder exists...

bnoll
3-Visitor

Determine if a Windows folder exists...


So I have code that will create a Windows folder, but prior to making this folder I would like to test to see if it exists and ifit does exist do some kind of processing to the data in the folder (prompt user before removing data).


There currently is no command in SA that will allow me to determine if the folder exists in one short statement. I am finding that I need to issue some command and catch an error so I know the folder does not exist.


I have a few ways of attempting to complete this, but I am interested in how others accomplished this task and what process they may have used to do so. It is hard for me to believe I am the first to want to complete such a task...


Any help is appreciated!



Regards,


Brian Noll


Project Manager, Design Proces Automation


Johnson Controls Inc.


Wildfire 4.0 (M220), Windchill (M040), SmartAssembly 5.0 (M110)



This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
2 REPLIES 2

I just tried both the READ_DIRECTORY and READ_SUBDIRECTORIES and they do not appear to error out when unable to find a directory. Instead, p


READ_SUBDIRECTORIES "myPath" mySubDirArray


FOR mySubDir REF ARRAY mySubDirArray


IF mySubDir == checkDir


! sub-directory exists, run your other code here


! BREAK


END_IF


END_FOR


--Geoff

bnoll
3-Visitor
(To:bnoll)

Geoff -

Yep, this works well. Thank you for the response.

Brian
Top Tags