首先必须引用windows api函数库 shellapi
***************************以下为复制文件夹的代码*********************************
function CopyDirectory(const Source, Dest: string): boolean;
///复制Source整个目录到DEST目录,如果Dest不存在,自动建立,如果DEST存在,那么Source将作为Dest的子目录!//例如如果要复制E:\Temp整个目录到E:\那么代码为: copydirectory('e:\temp','e:\');///如果要复制E:\Temp到E:\Test目录下面,那么代码为:CopyDirecotry('E:\Temp','E:\TEST');var fo: TSHFILEOPSTRUCT;begin FillChar(fo, SizeOf(fo), 0); with fo do begin Wnd := 0; wFunc := FO_COPY; pFrom := PChar(source+#0); pTo := PChar(Dest+#0); fFlags := FOF_NOCONFIRMATION+FOF_NOCONFIRMMKDIR ; end; Result := (SHFileOperation(fo) = 0);end;