Results 1 to 8 of 8

Thread: [RESOLVED] "Permission Denied" when copy folder

  1. #1

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Resolved [RESOLVED] "Permission Denied" when copy folder

    vb Code:
    1. Private Sub CopyFile()
    2.  
    3. Dim fsObject As FileSystemObject
    4. Set fsObject = New FileSystemObject
    5.  
    6. fsObject.CopyFolder "\\serverName\SPPS\pKCb\Reports", "c:\SPPS\pKCb\", True
    7.  
    8. Set fsObject = Nothing
    9.  
    10. End Sub

    Hi All,

    Above is my code that hitting error when I'm trying to copy over one of the folder from server to client PC. The error message is "Permission Denied (70)"
    Anyone can guide me to resolve my problem?

    Thanks a million.
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  2. #2
    "Digital Revolution"
    Join Date
    Mar 2005
    Posts
    4,471

    Re: "Permission Denied" when copy folder

    Are you able to manually copy that folder using Windows explorer?

  3. #3

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: "Permission Denied" when copy folder

    Quote Originally Posted by DigiRev View Post
    Are you able to manually copy that folder using Windows explorer?
    Yes, I had tried it.
    is it system ask permission to overwrite the file encountered permission issue?
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  4. #4
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: "Permission Denied" when copy folder

    Yes you don't have permissions to write to "c:\SPPS\pKCb\" but I wouldn't be surprised if you create a folder on your desktop and supply that path as the destination folder. Sometimes only the Desktop is left unlocked... like in my company
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  5. #5

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: "Permission Denied" when copy folder

    Quote Originally Posted by koolsid View Post
    Yes you don't have permissions to write to "c:\SPPS\pKCb\" but I wouldn't be surprised if you create a folder on your desktop and supply that path as the destination folder. Sometimes only the Desktop is left unlocked... like in my company

    I think lock is not the issue in my situation because I still can overwrite the file once I was clicked on Yes button hehe....

    Any suggestion or solution to resolve my problem
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: "Permission Denied" when copy folder

    How about deleting everything in the folder before making a new copy of it?

  7. #7
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: "Permission Denied" when copy folder

    You could solve this by two ways. One thing is this
    1.Check that the folder exits or not using FolderExists Method.If exist delete it and copy it.
    2. Or use the overwrite attribute to true

    object.CopyFolder ( source, destination[, overwrite] );
    Refer : MSDN
    Please mark you thread resolved using the Thread Tools as shown

  8. #8

    Thread Starter
    Hyperactive Member nUflAvOrS's Avatar
    Join Date
    Jul 2007
    Location
    Malaysia/ Currently at Singapore
    Posts
    372

    Re: "Permission Denied" when copy folder

    Thanks Hack and danasegarane,

    The problem was rectified by checking folder exist. If folder exist then delete the folder and making the new copy of it.
    Where there is no hope, there can be no endeavor.

    There are two ways of rising in the world, either by your own industry or by the folly of others.

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