//copyf - copy file or folder with content #ifndef INCLUDE_COPYF_H #define INCLUDE_COPYF_H #print "[include ]\n" #ifndef INCLUDE_FILESYSTEM_H #include "../lib/fs.h" #endif :int copyf(dword from1, in1) { dword error; BDVK CopyFile_atr1; if (!from1) || (!in1) { notify("Error: too few copyf() params!"); return; } if (error = GetFileInfo(from1, #CopyFile_atr1)) { debugln("Error: copyf->GetFileInfo"); return error; } if (dir_exists(from1)) return CopyFolder(from1, in1); else { Operation_Draw_Progress(from1+strrchr(from1, '/')); return CopyFile(from1, in1); } } :int CopyFile(dword copy_from3, copy_in3) { BDVK CopyFile_atr; dword error, cbuf; dword block; if (error = GetFileInfo(copy_from3, #CopyFile_atr)) { debugln("Error: CopyFile->GetFileInfo"); } else { if (GetFreeRAM()-1024*1024 < CopyFile_atr.sizelo) //GetFreeRam-1Mb and convert to bytes { if (error = CopyFileByBlocks(CopyFile_atr.sizelo, copy_from3, copy_in3)) debugln("Error: CopyFile->CopyFileByBlocks"); } else { if (error = CopyFileAtOnce(CopyFile_atr.sizelo, copy_from3, copy_in3)) debugln("Error: CopyFile->CopyFileAtOnce"); } } if (error) debug_error(copy_from3, error); return error; } :int CopyFolder(dword from2, in2) { dword dirbuf, fcount, i, filename; char copy_from2[4096], copy_in2[4096], error; if (error = GetDir(#dirbuf, #fcount, from2, DIRS_ONLYREAL)) { debugln("Error: CopyFolder->GetDir"); debug_error(from2, error); free(dirbuf); return error; } if (chrnum(in2, '/')>2) && (error = CreateDir(in2)) { debugln("Error: CopyFolder->CreateDir"); debug_error(in2, error); free(dirbuf); return error; } for (i=0; i