Results 1 to 9 of 9

Thread: file copy problem

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    32

    file copy problem

    alright this is my last question of the day =O

    anyway so im trying to do a file copy with this code

    FileCopy FileName, "C:\Users\Asus Man\programing stuff"

    Filename is the variable that carries the filename so thats working but i keep getting the error: "Path/file access error"

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: file copy problem

    If the target path does not exist, it needs to be created.
    If the target file has read-only, hidden, and/or system attributes, error.
    Be sure to include the new file name in the target path, even if the filename is not changing.

    1. Ensure the target path exists. Can use Dir() to do this
    2. Test the target file attributes with GetAttr() function
    3. Change the target attr if needed: SetAttr(targetfilename, vbNormal)
    4. Then try to copy
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    32

    Re: file copy problem

    im not linking it to a file...im copying it to a folder?

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: file copy problem

    All of what I posted still applies. When I mentioned target file, it applies if you are overwriting an existing file.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    32

    Re: file copy problem

    ok when i do GetAttr i get 16?

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: file copy problem

    16 = vbDirectory. It's telling you the path is a directory. As I mentioned earlier, and probably the reason for the problem, "Be sure to include the new file name in the target path, even if the filename is not changing."
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    32

    Re: file copy problem

    Quote Originally Posted by LaVolpe View Post
    16 = vbDirectory. It's telling you the path is a directory. As I mentioned earlier, and probably the reason for the problem, "Be sure to include the new file name in the target path, even if the filename is not changing."
    is there anyway to copy it with the same filename?

  8. #8

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    32

    Re: file copy problem

    Quote Originally Posted by hans4 View Post
    is there anyway to copy it with the same filename?
    or get the file name when u click it?

  9. #9

    Thread Starter
    Member
    Join Date
    Feb 2009
    Posts
    32

    Re: file copy problem

    nvm got it

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width