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. SHFileOperation is pissing me off - won't copy just 1 file

SHFileOperation is pissing me off - won't copy just 1 file

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
6 Posts 3 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.
  • A Offline
    A Offline
    AceCoolie
    wrote on last edited by
    #1

    I'm using SHFileOperation to copy some files. If I set pFrom to a string with multiple, fully quailified filenames, seperated by a NULL with an additional NULL character at the end and pTo to a string with a fully qualified directory with the extra NULL character, it works fine. If my pFrom is only 1 fully quailified filename with the extra NULL character at the end, SHFileOperation instead makes a file with the pTo directory name of the size of the source file. Example... pFrom = c:\pictures\pic1.jpg, c:\pictures\pic2.jpg, etc... pTo = d:\jpg When I check the drive, I'll have d:\jpg folder containing all my files pic1.jpg, pic2.jpg, etc. If I'm only copying 1 file, pFrom = c:\pictures\pic1.jpg pTo = d:\jpg This time, I'll check the drive and I'll have file called jpg in d:\ with the size of pic1.jpg. I'm pulling my hair out trying to figure out whats going on. I've checked and I have the buffers set up correctly with additional NULLs at the ends etc. Anyone know what the problem is? Thanks, Steve

    W J 2 Replies Last reply
    0
    • A AceCoolie

      I'm using SHFileOperation to copy some files. If I set pFrom to a string with multiple, fully quailified filenames, seperated by a NULL with an additional NULL character at the end and pTo to a string with a fully qualified directory with the extra NULL character, it works fine. If my pFrom is only 1 fully quailified filename with the extra NULL character at the end, SHFileOperation instead makes a file with the pTo directory name of the size of the source file. Example... pFrom = c:\pictures\pic1.jpg, c:\pictures\pic2.jpg, etc... pTo = d:\jpg When I check the drive, I'll have d:\jpg folder containing all my files pic1.jpg, pic2.jpg, etc. If I'm only copying 1 file, pFrom = c:\pictures\pic1.jpg pTo = d:\jpg This time, I'll check the drive and I'll have file called jpg in d:\ with the size of pic1.jpg. I'm pulling my hair out trying to figure out whats going on. I've checked and I have the buffers set up correctly with additional NULLs at the ends etc. Anyone know what the problem is? Thanks, Steve

      W Offline
      W Offline
      Waldermort
      wrote on last edited by
      #2

      I don't think much of the title to your post!

      A 1 Reply Last reply
      0
      • A AceCoolie

        I'm using SHFileOperation to copy some files. If I set pFrom to a string with multiple, fully quailified filenames, seperated by a NULL with an additional NULL character at the end and pTo to a string with a fully qualified directory with the extra NULL character, it works fine. If my pFrom is only 1 fully quailified filename with the extra NULL character at the end, SHFileOperation instead makes a file with the pTo directory name of the size of the source file. Example... pFrom = c:\pictures\pic1.jpg, c:\pictures\pic2.jpg, etc... pTo = d:\jpg When I check the drive, I'll have d:\jpg folder containing all my files pic1.jpg, pic2.jpg, etc. If I'm only copying 1 file, pFrom = c:\pictures\pic1.jpg pTo = d:\jpg This time, I'll check the drive and I'll have file called jpg in d:\ with the size of pic1.jpg. I'm pulling my hair out trying to figure out whats going on. I've checked and I have the buffers set up correctly with additional NULLs at the ends etc. Anyone know what the problem is? Thanks, Steve

        J Offline
        J Offline
        Justin Tay
        wrote on last edited by
        #3

        Have you tried sticking a '\' at the back of pTo? eg. pTo = d:\jpg\.

        A 1 Reply Last reply
        0
        • J Justin Tay

          Have you tried sticking a '\' at the back of pTo? eg. pTo = d:\jpg\.

          A Offline
          A Offline
          AceCoolie
          wrote on last edited by
          #4

          Thanks. I tried that and it and with the extra "\", it's not a vailid file name and generates an error.

          J 1 Reply Last reply
          0
          • W Waldermort

            I don't think much of the title to your post!

            A Offline
            A Offline
            AceCoolie
            wrote on last edited by
            #5

            Sorry, I was pretty frustrated when I wrote it.

            1 Reply Last reply
            0
            • A AceCoolie

              Thanks. I tried that and it and with the extra "\", it's not a vailid file name and generates an error.

              J Offline
              J Offline
              Justin Tay
              wrote on last edited by
              #6

              Then I guess that your only alternative is to set pTo to d:\jpg\pic1.jpg

              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