Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I know if a folder exists
Message
 
 
À
17/11/2004 16:02:44
Sergio Ortiz
Tek Services Group, Llc
Hollywood, Floride, États-Unis
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00962392
Message ID:
00962450
Vues:
18
Here's another way using WSH
DECLARE @RetVal int, @FSO int, @hr int, @Folder int
DECLARE @FolderName varchar(256), @NewFolderName varchar(256)
SET @FolderName = 'H:\tmp\Klm'
SET @NewFolderName = 'NewName'
EXEC @hr = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
EXEC @hr = sp_OAMethod @FSO, 'FolderExists', @RetVal OUT, @FolderName
IF @RetVal <> 0 BEGIN
	EXEC @hr = sp_OAMethod @FSO, 'GetFolder', @Folder OUT, @FolderName
	IF @hr = 0
		EXEC @hr = sp_OASetProperty @Folder, 'Name', @NewFolderName
END
EXEC @hr = sp_OADestroy @FSO
>
>I am trying to determine if a folder exist on my server.
>If the folder exist I would like to rename it.
>
>I know I can use the xp_fileexist extended procedure but I do not know how to determined if it is a folder.
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform