1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

renaming folders.

Discussion in 'C#' started by red_fiesta, Dec 5, 2006.

  1. #1
    I have an form where there are 4 text boxes that passes to the next page

    on this next page folders are created from these 4 text boxes

    this inital page also allows users to change names if the like, so i need to rename the folders they have changed.

    how do i rename these folders that have changed.

    first i can have a loop which checks the text they have written against the stored version in the db.. if there is a difference i can rename the folder keeping its contents...

    any ideas on how to do this, i have been searching bit cant find anything...

    thanks
     
    red_fiesta, Dec 5, 2006 IP
  2. Link.ezer.com

    Link.ezer.com Peon

    Messages:
    647
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Tips: never duplicate folders

    try the code
    may it help
    hope the code can give you an idea

    <%
    If not rs.EOF then
    OldFolder=rs("Name")
    sFolderName = "C:\"&OldFolder
    sNewName = Newfolder

    Set fso = CreateObject("Scripting.FileSystemObject")

    If fso.FolderExists(sFolderName) Then
    Set fd = fso.GetFolder(sFolderName)
    sTemp = fd.Drive & "\" & sNewName
    If fso.FolderExists(sTemp) Then
    'do nothing
    Else
    fd.Name = sNewName
    End If
    Else
    'do nothing
    End If
    End if
    rs.close
    %>

    If you find out a better way to do it please also post here.
     
    Link.ezer.com, Dec 12, 2006 IP