Create Subfolders in my current .fmp12 directory

Discussion created by SONICARC on Jul 26, 2017
Latest reply on Jul 27, 2017 by Jens Teich


I’m trying to create a script where i can get the file path of the current .fmp12 file and in that same directory create several subfolders that will be named in the same script.



I’ve seen lots of examples online that utilise AppleScript syntax that looks at the System Desktop or `Documents folder rather than the directory folder that holds the fmp12 file.



I know how to solve this problem by using Get (Directory), but I have to manually name each new folder one at a time.



I managed another workaround that uses the following Native AppleScript:


set folderpath to POSIX path of (choose folder with prompt "Select client folder")

do shell script "mkdir -p " & (quoted form of (folderpath )) & "{\"Payments\",\"Overdue\",\"Attendance\",\"Personnel\"}"


Again, I initially have to manually navigate to the directory folder where my .fmp12 file resides in order to auto-create the sub-folders in the script.




So far, I have a created a var that gets the fmp12 holding directory and adds a Reports folder that will then contain my subfolders (this might be wrong)


Set Variable [ $fmpPath ;

Value: Let ( [ filePath = Middle ( Get ( FilePath ) ; 6 ; Length ( Get ( FilePath ) ) ) ;

          LeftPath = Left ( filePath ; Position ( filePath ; Get ( FileName ) ; 1 ; 1 ) - 1 )

        ] ; LeftPath & "Reports/" )



but trying to create a set of subfolders within the newly created Reports folder using a Calculated Perform AppleScript, leaves me stumped.



A non-plugin solution will be much appreciated and teach me what I simply cannot fathom at this stage.


(I'm using FMP 15 Advanced with OS Sierra 10.12.6)