Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
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)
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