Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. My new problem is to copy directory

My new problem is to copy directory

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rajneshmalik
    wrote on last edited by
    #1

    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

    N 1 Reply Last reply
    0
    • R rajneshmalik

      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

      N Offline
      N Offline
      Nishad S
      wrote on last edited by
      #2

      You can use SHFileOperation API OR You have to search all files/folders recursively, also copy/create respectively. CFileFind will help you.

      - NS - [ODBaseBtn]

      R 1 Reply Last reply
      0
      • N Nishad S

        You can use SHFileOperation API OR You have to search all files/folders recursively, also copy/create respectively. CFileFind will help you.

        - NS - [ODBaseBtn]

        R Offline
        R Offline
        rajneshmalik
        wrote on last edited by
        #3

        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"); }

        N 1 Reply Last reply
        0
        • R rajneshmalik

          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"); }

          N Offline
          N Offline
          Nishad S
          wrote on last edited by
          #4

          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]

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups