2
所以我创建了一个pascal脚本,它将在主目录内创建一个目录,并且在该新目录内创建多个文件夹。 (插入XZibit双关语)PASCAL:通过数组循环来创建文件夹?
现在我们做这个工作的方式,我们将这些变量发送到一个exe文件,然后根据传递的内容(在这种情况下,路径'fullpath')创建目录。
我不知道如果我正确地处理这个,他会喜欢的更为突出PASCAL大师的输入:)
const
ARRAY1: Array[1..9] of String = (
'NQN', 'Documents', 'Correspondences',
'Worksheets', 'Reports', 'Claims',
'Certificate of Insurance', 'Invoice', 'Monthly Reports'
);
var
i: Integer;
fullpath, path, name, os, es, cmd: String;
Code : LongWord;
res: Integer;
Begin
path := 'Policies'
fullpath := path+'\'+[i]
for i := 1 to 9 do
IF(ReqList.Values['sRM_ID'] = '') then
Begin
cmd := 'C:\XXX\bin\mkdir.exe "'+fullpath+'"';
res :=ExecuteProc(cmd, 'C:\XXX\bin', true, -1, true, nil, os, es, code);
if(res = 0) then
Begin
ReqList.values['NoErrors'] := '1';
ReqList.Values['Response_content']:= '{"valid":"1","message":"'+ReplaceString(ReplaceString(os,#13,'',false),#10,'',false)+'"}';
end
else
begin
ReqList.Values['NoErrors'] := '0';
Reqlist.Values['Response_Content'] := '{"valid":"0","message":"'+ReplaceString(ReplaceString(os,#13,'',false),#10,'',false)+'"}';
end;
END
ELSE
Begin
ReqList.Values['Response_Content'] := '{"valid":"0","message":"A folder or file with the same name already exists."}';
End;
ReqList.Values['Response_ContentType'] := 'HTML';
就以[ForceDirectories]看看(http://docs.embarcadero.com/products/ rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/delphivclwin32/SysUtils_ForceDirectories.html)并使用* real *(完整)fullpathes。 – bummi
使用脚本语言编写脚本任务更有意义 –
exe使用它的预定目录,然后将提供的路径以这些文件夹的目标为基础。 我打算为ForceDirectories保留该选项卡,因为这看起来非常有用。 – Doodely