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.

copy and rename

Discussion in 'C#' started by red_fiesta, Nov 7, 2006.

  1. #1
    
    <%
    
    set objFSO = server.CreateObject("Scripting.FileSystemObject")
    
    
    strFolderName=server.MapPath("../website/File/dan1/") & "/"
    objFSO.CreateFolder strFolderName
    
    strCopyAddress=server.MapPath("../siteTemplates/" & "/")
    strCopyAddress = strCopyAddress & "\default.asp"
    objFSO.CopyFile strCopyAddress, strFolderName
    
    Set objFSO = Nothing
    
    
    
    %>
    Code (markup):
    The above code copies the folder to siteTemplates to dan1 but it only copies the file.

    I need to copy the file and rename it, ie get the default.asp and place it in the folder dan1 with another name as a file called default.asp will already exist there. for this example lets say i want the page to be called roger.asp

    any ideas?
     
    red_fiesta, Nov 7, 2006 IP
  2. sunpost

    sunpost Peon

    Messages:
    23
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try adding the destination file name to the CopyFile...
    <%
    set objFSO = server.CreateObject("Scripting.FileSystemObject")
    
    strFolderName=server.MapPath("../website/File/dan1/") & "/"
    objFSO.CreateFolder strFolderName
    
    strCopyAddress=server.MapPath("../siteTemplates/" & "/")
    strCopyAddress = strCopyAddress & "\default.asp"
    objFSO.CopyFile strCopyAddress, strFolderName[B] &  "\roger.asp"[/B]
    
    Set objFSO = Nothing
    %>
    Code (markup):
     
    sunpost, Nov 7, 2006 IP