Using File System Objects


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Using File System Objects

  1. #1
    David Knox Guest

    Using File System Objects


    I have written code to move folders between drives but it gives an error message
    when it gets to the MoveFolder method. With my existing code I can move folders
    between directories within the same drive successfully. Is this problem because
    I'm using the name property of a folder in the one drive to add it to the
    absolute path of an existing directory in the other drive, so that I can
    build a path in which the folder does not yet exist so that it will create
    that folder on the second drive and move the folders between the drives.
    If the use of the name property causes this problem,how do I get around it.
    If you could possibly help me and also give some code that achieves this
    I would be most greatful.

    Thanks a lot
    David

  2. #2
    Phil Weber Guest

    Re: Using File System Objects

    David: Your question doesn't really seem to be about OOP (Object-Oriented
    Programming). If you don't get an answer here, you might try reposting your
    question to the vb.general newsgroup. Thanks!
    ---
    Phil Weber
    DevX Newsgroup Admin



  3. #3
    Rodney Marr Guest

    Re: Using File System Objects


    I too am working on something that has to Move folders from one drive to another.
    Whenever I use the Move folder Method. The specific error that I got was
    "Permission Denied." I also got this error using vbscript and the Movefolder
    method. I just tried it again. And I got "Runtime Error 70" "Permission Denied"
    This is the Code I am using

    Private Sub Command1_Click()
    Set fso = CreateObject("Scripting.FileSystemObject")
    fso.movefolder "c:\t", "m:\t"
    End Sub

    There is no folder on M: that is named "t". Is this Method the Most efficient
    way to move a folder? I got around this by simple copying the folder, then
    deleting it. but I would like to be able to be sure the copy matched the
    original before deleting it. any help would be appreciated.
    Thank You.
    Rodney Marr

    "David Knox " <mwknoxy@mweb.co.za> wrote:
    >
    >I have written code to move folders between drives but it gives an error

    message
    >when it gets to the MoveFolder method. With my existing code I can move

    folders
    >between directories within the same drive successfully. Is this problem

    because
    >I'm using the name property of a folder in the one drive to add it to the
    >absolute path of an existing directory in the other drive, so that I can
    >build a path in which the folder does not yet exist so that it will create
    >that folder on the second drive and move the folders between the drives.
    >If the use of the name property causes this problem,how do I get around

    it.
    >If you could possibly help me and also give some code that achieves this
    >I would be most greatful.
    >
    >Thanks a lot
    >David



  4. #4
    victor Guest

    Re: Using File System Objects


    Hi,

    I noticed that this type of error pops up if Windows Explorer is open and
    the folder or file within it I am trying to manipulate is selected. Another
    reason is if file from the folder is open by another process. The remedy
    is to select any other folder or release the file.

    I also experienced same error trying to delete folder and files within it
    in one shot. The behavior was not stable, so I delete files first and then
    folder.

    It seems that the "aggragated" operations (move=copy+delete, delete folder=delete
    files+delete folder) do not behave as expected. May be we do not read documentation
    properly.

    This is extract from MSDN help on MoveFolder:

    "Important This method allows moving folders between volumes only if supported
    by the operating system."

    May be there is some conflict between versions of Scripting Runtime and particular
    Windows?

    victor

    "Rodney Marr" <rodmarr@mailcity.com> wrote:
    >
    >I too am working on something that has to Move folders from one drive to

    another.
    >Whenever I use the Move folder Method. The specific error that I got was
    >"Permission Denied." I also got this error using vbscript and the Movefolder
    >method. I just tried it again. And I got "Runtime Error 70" "Permission

    Denied"
    >This is the Code I am using
    >
    >Private Sub Command1_Click()
    > Set fso = CreateObject("Scripting.FileSystemObject")
    > fso.movefolder "c:\t", "m:\t"
    >End Sub
    >
    >There is no folder on M: that is named "t". Is this Method the Most efficient
    >way to move a folder? I got around this by simple copying the folder, then
    >deleting it. but I would like to be able to be sure the copy matched the
    >original before deleting it. any help would be appreciated.
    >Thank You.
    >Rodney Marr
    >
    >"David Knox " <mwknoxy@mweb.co.za> wrote:
    >>
    >>I have written code to move folders between drives but it gives an error

    >message
    >>when it gets to the MoveFolder method. With my existing code I can move

    >folders
    >>between directories within the same drive successfully. Is this problem

    >because
    >>I'm using the name property of a folder in the one drive to add it to the
    >>absolute path of an existing directory in the other drive, so that I can
    >>build a path in which the folder does not yet exist so that it will create
    >>that folder on the second drive and move the folders between the drives.
    >>If the use of the name property causes this problem,how do I get around

    >it.
    >>If you could possibly help me and also give some code that achieves this
    >>I would be most greatful.
    >>
    >>Thanks a lot
    >>David

    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center