我要实现从一个文件夹A中的jpg文件全部转移到到文件夹b中。但是A中的文件数目和文件名是未知的。请教各位大虾!怎么实现?是不是在DELPHI中也有文件指针的东东!?我用CHDIR把当前目录改为A,但是不知道怎么办了?因为没有像文件指针的东西!谢谢了!
解决方案 »
- 接收HTML邮件的问题
- delphi开发的模块ocx网页发布的问题(高分求教)
- 如果取本机所有网卡(包括没有连接)mac地址?急急集-----------
- AdvStringGrid中点cell时出现文本框,离开就没了
- fastreport分栏打印问题急救,在线等...
- 一个简单的网络问题: 使用什么控件可以调用如下语句:http://xxx.xxx.xx.xx/Test.asp?? (youngzy )
- 注册表的二进制值
- 求DELPHI开发ACTIVEX用于WEB打印指定内容的实现说明。
- !!急救,请问谁有关于透明代理NAT技术的资料!!!
- DELPHI + ADO + MSSQL 高手请进
- 变量定义和dictionary对象的问题
- 怎样把sqldataset的数据源设为sql server2000数据库的视图
直接转移文件夹
我帮你做好了~~~
假设你原来的目录为 c:\tyn1 你现在想备份到 c:\tyn2目录下
~~~~~~
procedure TForm1.Button1Click(Sender: TObject);
var
FileOpStruct :TSHFileOpStruct;
Buf1 :array [0..127] of Char;
Buf2 :array [0..127] of Char;
Str1,Str2 :String;
begin
Str1 :='c:\tyn1';
Str2 :='c:\tyn2';
FillChar(Buf1,SizeOf(Buf1),0);
FillChar(Buf2,SizeOf(Buf2),0);
StrPCopy(Buf1,Str1);
StrPCopy(Buf2,Str2);
with FileOpStruct do
begin
Wnd :=Handle;
wFunc :=FO_COPY;
pFrom :=@Buf1;
pTo :=@Buf2;
fFlags :=FOF_SIMPLEPROGRESS;
fAnyOperationsAborted :=False;
hNameMappings :=nil;
lpszProgressTitle :='拷贝文件';
end;
SHFileOperation(FileOpStruct);
end;
procedure TfmTaskSearcher.SearchTask(const sDir, sExtension: String);
var
sSearchPath: String;
sr: TSearchRec;
NewItem: TListItem;
iCount: Integer;
sCaption: String;
begin
iCount := 0;
if Copy(sDir, Length(sDir), 1) <> '\' then
sSearchPath := sDir + '\'
else
sSearchPath := sDir;
if FindFirst(sSearchPath + '*.'+ sExtension, 0, sr) = 0 then
begin
with FileListView do
begin
sCaption := sSearchPath + sr.Name;
if FindCaption(1, sCaption, False, True, True) = nil then
begin
NewItem := Items.Add;
NewItem.Caption := sCaption;
Inc(iCount);
end;
while FindNext(sr) = 0 do
begin
sCaption := sSearchPath + sr.Name;
if FindCaption(1, sCaption, False, True, True) = nil then
begin
NewItem := Items.Add;
NewItem.Caption := sCaption;
Inc(iCount);
end;
end;
end;
FindClose(sr);
end;
if iCount > 0 then
begin
MessageBox(0, Pchar('You have ' + IntToStr(iCount) + ' new tasks!'), 'Information', MB_OK + MB_ICONINFORMATION);
end;
end;