Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I know if a folder exists
Message
 
 
To
17/11/2004 16:02:44
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00962392
Message ID:
00962450
Views:
19
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--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform