08-02-2012, 01:19 AM
I am sorry to bother you again, in the final stages of my macro I can't finish it because of a very "simple" problem.
I am trying to create a directory structure from an array, but I keep getting the error:
I simplified the part where everything stops:
Macro Macro3
I am guessing that when the second array index is beeing processed, it halts because "d:\test" already exists? (the green 'commented out' block was another attempt where I incorporated the whole path, but it didn't work either)
Is there any way around this? The "mkdir" command hasn't got any special flags (overwrite?) I can use.
The final form of the code will be sometehing like this
Macro xml_folder_structure_builder
{folder_structure[m1i]} and {snippet_title} will be retrieved from an array
I am trying to create a directory structure from an array, but I keep getting the error:
Error (RT) in Macro3: cannot create folder: Cannot create a file when that file already exists. ?
I simplified the part where everything stops:
Macro Macro3
out
ARRAY(str) path_string
str drive="d:\test\"
int i
path_string.create(3)
path_string[0]="mainfolder-1\sub-1\sub-sub-1\"
path_string[1]="mainfolder-2\sub-2\"
path_string[2]="mainfolder-3\sub3\sub-sub-3\sub-sub-sub-3\"
;path_string[0]="d:\test\mainfolder-1\sub-1\sub-sub-1\"
;path_string[1]="d:\test\mainfolder-2\sub-2\"
;path_string[2]="d:\test\mainfolder-3\sub3\sub-sub-3\sub-sub-sub-3\"
;
for i 0 path_string.len
,out "%i %s" i path_string[i]
,mkdir F"{drive}{path_string[i]}"
I am guessing that when the second array index is beeing processed, it halts because "d:\test" already exists? (the green 'commented out' block was another attempt where I incorporated the whole path, but it didn't work either)
Is there any way around this? The "mkdir" command hasn't got any special flags (overwrite?) I can use.
The final form of the code will be sometehing like this
Macro xml_folder_structure_builder
str filePath=F"d:\test\{folder_stucture[m1i]}\{snippet_title}.txt"
snippet_content.setfile(filePath)
{folder_structure[m1i]} and {snippet_title} will be retrieved from an array