dcsimg
Results 1 to 4 of 4

Thread: Moving folder with children

  1. #1

    Thread Starter
    Hyperactive Member Peekay's Avatar
    Join Date
    Sep 2006
    Location
    Witbank, South Africa
    Posts
    375

    Moving folder with children

    I have this client side routine for moving a folder with its children to another folder (using HTTP POST):

    Code:
    Public Function MoveFolder(PresentFolderName As String, DestinationFolderName As String) As Boolean
    Dim Rs As Recordset, FileAndFolderName As String
        
    Set Rs = RPC.DoRPC("MoveFolder", PresentFolderName, DestinationFolderName)
    
    If Rs(0) = True Then
        MoveFolder = True: Exit Function
    Else
        MoveFolder = False
        frmAll.WarnUser Failure, Rs(0): Exit Function
    End If
    
    End Function
    The serverside routine is as follows:

    Code:
    Public Sub MoveFolder()
    Dim oFSO As New FileSystemObject
    
    If oFSO.FolderExists(App.Path & "\" & RsIn(1)) = False Then Set RsOut = CreateResultRs("MoveFolder", "Present folder does not exist"): Exit Sub
    If oFSO.FolderExists(App.Path & "\" & RsIn(2)) = False Then Set RsOut = CreateResultRs("MoveFolder", "Destination folder does not exist"): Exit Sub
    
    On Error GoTo FolderNotMoved
    Set oFSO = CreateObject("Scripting.FileSystemObject")
    Call oFSO.CopyFolder(App.Path & "\" & RsIn(1), App.Path & "\" & RsIn(2))
    Call oFSO.DeleteFolder(App.Path & "\" & RsIn(1), True)
    Set oFSO = Nothing
    On Error GoTo 0
    Set RsOut = CreateResultRs("MoveFolder", True): Exit Sub
    Exit Sub
    
    FolderNotMoved:
    Set RsOut = CreateResultRs("MoveFolder", "Could not move folder"): Exit Sub
    
    End Sub
    It gives me an error that it cannot persist the ADTG recordset which I cannot sort out.

    Thanks
    PK

  2. #2

  3. #3

    Thread Starter
    Hyperactive Member Peekay's Avatar
    Join Date
    Sep 2006
    Location
    Witbank, South Africa
    Posts
    375

    Re: Moving folder with children

    The problem was a query not related to the moving of the folder, but with registering this action on a log:

    Code:
    Set Rs = modRemoteDB.GetRs("SELECT UPDATE registry REPLACE('fileandfoldername'," & lblSubFolderName.Caption & "','" & lblSubFolderName.Caption & "') WHERE fileandfoldername LIKE '%" & lblSubFolderName.Caption & "%'")
        If Not modRemoteDB.UpdateBatch(Rs) Then frmAll.WarnUser Failure, " The registry for moving the folder from " & lblSubFolderName.Caption & " to folder " & lblSubFolderName.Caption & " could not be updated": Exit Sub
    Set Rs = Nothing
    Which reads as:
    Code:
    SELECT UPDATE registry REPLACE('fileandfoldername',Docs/IBMSphcc/Admin/Correspondence','Docs/IBMSphcc/Admin/Correspondence') WHERE fileandfoldername LIKE '%Docs/IBMSphcc/Admin/Correspondence%'
    It is the first time I use this replace type of query and need some help.

    Thanks
    PK
    Last edited by Peekay; Dec 4th, 2019 at 11:34 PM.

  4. #4
    Frenzied Member wqweto's Avatar
    Join Date
    May 2011
    Posts
    1,603

    Re: Moving folder with children

    I have no idea what SELECT UPDATE might be. Probably just UPDATE?

    REPLACE function params seem borked too. Mind the quotes!

    String linterals are in quotes, columns names are w/o quotes, e.g. use REPLACE(fileandfoldername, 'a', 'b') to replace in column fileandfoldername all 'a's with 'b's.

    cheers,
    </wqw>

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width