Índice
Tutoriales
>
ASP
> Archivos
Calificación del Código:
Promedio: 9, con 2 voto(s).
Titulo: Copiar archivos
Categoria: Archivos
1208 visitas desde: 12/01/2005
Descripción: Permite copiar archivos ubicados en el servidor
Código
<% '|Author: Joaquim José Prates Ferreira '|Description: This function will copy Files From [ A ] to [ B ] '|This function will copy a file from one Folder to another. '|E.G: '| Call Generic_FileCopy("D:\Xkudos\NewsX_1997.mdb","D:\Xkudos\Xkudos\Xkudos\DB\NewsX_1997.mdb",True) Function Generic_FileCopy(ByVal strFileSource,ByVal strFileDestination,ByVal strOverWrite) '--------------------------------[ERROR CHECKING]-------------------------------- ' ERROR CHECKING!!!!... IF strFileSource = "" or isnull(strFileSource) Then Response.Write("Sorry but a File Source path is required when calling this function") Response.End End IF ' ERROR CHECKING!!!!... IF strFileDestination = "" or isnull(strFileDestination) Then Response.Write("Sorry but a File Destination path is required when calling this function") Response.End End IF ' ERROR CHECKING!!!!...[True - False] IF strOverWrite = "" or isnull(strOverWrite) Then Response.Write("Sorry but a File Destination path is required when calling this function") Response.End End IF '--------------------------------[/ERROR CHECKING]-------------------------------- Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(strFileSource) Then fso.CopyFile strFileSource, strFileDestination, strOverWrite Else Response.Write("The file does not exist...") Response.End End If Set fso = Nothing End Function %>
Enviar a un amigo
Votar
Buscar