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