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. Copy all files in a folder?

Copy all files in a folder?

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 5 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.
  • S Offline
    S Offline
    Steven Richardson 0
    wrote on last edited by
    #1

    I am looking for some code that will copy all the files in one folder to another some where else?

    M M 2 Replies Last reply
    0
    • S Steven Richardson 0

      I am looking for some code that will copy all the files in one folder to another some where else?

      M Offline
      M Offline
      Mike Nordell
      wrote on last edited by
      #2

      system("cmd.exe /c xcopy * destination"); Replace destination with the destination of your choice.

      S 1 Reply Last reply
      0
      • M Mike Nordell

        system("cmd.exe /c xcopy * destination"); Replace destination with the destination of your choice.

        S Offline
        S Offline
        Steven Richardson 0
        wrote on last edited by
        #3

        wont that just copy the file cmd.exe not a folder?

        L 1 Reply Last reply
        0
        • S Steven Richardson 0

          I am looking for some code that will copy all the files in one folder to another some where else?

          M Offline
          M Offline
          Michael Dunn
          wrote on last edited by
          #4

          Check out SHFileOperation. --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm

          S 1 Reply Last reply
          0
          • M Michael Dunn

            Check out SHFileOperation. --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm

            S Offline
            S Offline
            Steven Richardson 0
            wrote on last edited by
            #5

            Hi, i was looking for it to be a console app? if that is possable because i dont know much about the workings of windows yet

            V M 2 Replies Last reply
            0
            • S Steven Richardson 0

              Hi, i was looking for it to be a console app? if that is possable because i dont know much about the workings of windows yet

              V Offline
              V Offline
              Venet
              wrote on last edited by
              #6

              // main goes here system("xcopy src dest"); have a look at xcopy syntax (xcopy /?) Regards, Venet. Donec eris felix, multos numerabis amicos.

              1 Reply Last reply
              0
              • S Steven Richardson 0

                Hi, i was looking for it to be a console app? if that is possable because i dont know much about the workings of windows yet

                M Offline
                M Offline
                Michael Dunn
                wrote on last edited by
                #7

                You can use SHFileOperation in a console app, just use NULL for the parent window. --Mike-- Just released - RightClick-Encrypt v1.4 - Adds fast & easy file encryption to Explorer My really out-of-date homepage Sonork-100.19012 Acid_Helm

                1 Reply Last reply
                0
                • S Steven Richardson 0

                  wont that just copy the file cmd.exe not a folder?

                  L Offline
                  L Offline
                  Luis Alonso Ramos
                  wrote on last edited by
                  #8

                  No, it will run CMD.EXE (the command processor) and the /C is perform automatically a command, in this case XCOPY *.* destination. -- LuisR ──────────────   Luis Alonso Ramos   Chihuahua, Mexico   www.luisalonsoramos.com "Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein

                  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