Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
read xml convert to folder/subfolder/text file
#9
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:
Code:
Copy      Help
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
Code:
Copy      Help
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
Code:
Copy      Help
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


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)