实在没有办法只有用,1打开指定文件职2在指定目录内创建对应的文件3将指定文件的内存数据一一读到创建的文件中
如果有一个函数就好了,我找了好久都没有找到,那位告诉我一下
3 个解决方案
#1
api: SHFileOperation
#2
uses ShellApi;
procedure TForm1.Button1Click(Sender: TObject);
var
F:TShFileOpStruct;
begin
with F do
begin
wnd:=Handle;
wFunc:=FO_MOVE;
pFrom:=PChar('E:\aa'+#0#0); //源文件夹
pTo:=PChar('E:\bb'+#0#0); //目标文件夹
fFlags:=FOF_ALLOWUNDO or FOF_RENAMEONCOLLISION or fof_noconfirmmkdir;
end;
if ShFileOperation(F)<>0 then
ShowMessage('File Move Fail');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
F:TShFileOpStruct;
begin
with F do
begin
wnd:=Handle;
wFunc:=FO_MOVE;
pFrom:=PChar('E:\aa'+#0#0); //源文件夹
pTo:=PChar('E:\bb'+#0#0); //目标文件夹
fFlags:=FOF_ALLOWUNDO or FOF_RENAMEONCOLLISION or fof_noconfirmmkdir;
end;
if ShFileOperation(F)<>0 then
ShowMessage('File Move Fail');
end;
#3
copyfile
#1
api: SHFileOperation
#2
uses ShellApi;
procedure TForm1.Button1Click(Sender: TObject);
var
F:TShFileOpStruct;
begin
with F do
begin
wnd:=Handle;
wFunc:=FO_MOVE;
pFrom:=PChar('E:\aa'+#0#0); //源文件夹
pTo:=PChar('E:\bb'+#0#0); //目标文件夹
fFlags:=FOF_ALLOWUNDO or FOF_RENAMEONCOLLISION or fof_noconfirmmkdir;
end;
if ShFileOperation(F)<>0 then
ShowMessage('File Move Fail');
end;
procedure TForm1.Button1Click(Sender: TObject);
var
F:TShFileOpStruct;
begin
with F do
begin
wnd:=Handle;
wFunc:=FO_MOVE;
pFrom:=PChar('E:\aa'+#0#0); //源文件夹
pTo:=PChar('E:\bb'+#0#0); //目标文件夹
fFlags:=FOF_ALLOWUNDO or FOF_RENAMEONCOLLISION or fof_noconfirmmkdir;
end;
if ShFileOperation(F)<>0 then
ShowMessage('File Move Fail');
end;
#3
copyfile