My new problem is to copy directory
-
hi to all I want to copy a directory which have sub-directories.I study CopyFile(); function but as i know it doesn't copy directory and a lot of sub-directory and i don't want to create those sub directory by code because there are a lot of directory How can i solve this problem thank you in advance
-
hi to all I want to copy a directory which have sub-directories.I study CopyFile(); function but as i know it doesn't copy directory and a lot of sub-directory and i don't want to create those sub directory by code because there are a lot of directory How can i solve this problem thank you in advance
You can use SHFileOperation API OR You have to search all files/folders recursively, also copy/create respectively. CFileFind will help you.
- NS - [ODBaseBtn]
-
You can use SHFileOperation API OR You have to search all files/folders recursively, also copy/create respectively. CFileFind will help you.
- NS - [ODBaseBtn]
my code is below but i got error on 7th line where am i wrong plz help SHFILEOPSTRUCT shFileOpStruct; shFileOpStruct.hwnd=NULL; shFileOpStruct.pFrom="C:\\1.txt"; shFileOpStruct.pTo="D:\\1.txt; shFileOpStruct.wFunc=FO_COPY; shFileOpStruct.fFlags=FOF_SIMPLEPROGRESS; if(!SHFileOperation(&shFileOpStruct)) { ::AfxMessageBox("File transfering"); } else { ::AfxMessageBox("File not transfering"); }
-
my code is below but i got error on 7th line where am i wrong plz help SHFILEOPSTRUCT shFileOpStruct; shFileOpStruct.hwnd=NULL; shFileOpStruct.pFrom="C:\\1.txt"; shFileOpStruct.pTo="D:\\1.txt; shFileOpStruct.wFunc=FO_COPY; shFileOpStruct.fFlags=FOF_SIMPLEPROGRESS; if(!SHFileOperation(&shFileOpStruct)) { ::AfxMessageBox("File transfering"); } else { ::AfxMessageBox("File not transfering"); }
rajneshmalik wrote:
shFileOpStruct.pTo="D:\\1.txt;
There is a missing " What error else it shows? [Added] One thing I noticed is that you have not initialized all the members of the SHFILEOPSTRUCT object. Try this... SHFILEOPSTRUCT shFileOpStruct = { 0 };
- NS - [ODBaseBtn]