快速删除零字节文件的小程序
#include <stdio.h>
#include <dir.h>
int main(void)
{
struct ffblk *fileblk;
int end;
int count_of_file=0;/*统计删除文件数*/
clrscr();/*清屏*/
printf("Delele file for longth=0\n");
printf("-------------\n");
end=findfirst("*.*",fileblk,0);/*取第一个文件*/
while(!end)
{ if (fileblk->ff_fsize==0)/*如果文件长度为零,则删除*/
{ printf(" %s delete!!\n",fileblk->ff_name);
unlink(fileblk->ff_name);
count_of_file++;
end=findnext(fileblk);/*取下一个文件*/ }
printf("%d files delete!!!\n",count_of_file);
return 0; }