Wrox Programmer Forums
|
Classic ASP Professional For advanced coder questions in ASP 3. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2006, 12:21 PM
Authorized User
 
Join Date: Oct 2006
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
Default copy and rename

Code:
<%

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



%>
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?

 
Old November 8th, 2006, 11:00 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the full path and name for the second parameter to the CopyFile method:

objFSO.CopyFile "C:\Oldfile.txt", "C:\NewFile.txt"

Of course, you would build your path and name parameters dynamically as you are already doing.

Have fun

Woody Z http://www.learntoprogramnow.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
copy an access database and then rename it . yeetesh VB Databases Basics 4 December 27th, 2007 09:26 AM
Copy worksheet to another workbook and rename it Probleminfinity Excel VBA 1 August 19th, 2007 11:38 PM
LNC Rename dmoffice Access VBA 6 November 16th, 2006 09:42 PM
NEWBIE: Copy and Rename arthurb XSLT 3 April 12th, 2006 01:00 PM
copy an access database and then rename it . yeetesh Beginning VB 6 1 January 7th, 2005 04:40 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.