Hello,
I want to copy JPG images from one folder to another except duplicate images with sql server. Does it possible to avoid duplicate images using script? How?
I wrote this script:
--show advanced configuration on
sp_configure 'show advanced options',1
reconfigure
go
--by default OLE Automation Procedures is off for security concern
--we can enable it by following command
sp_configure 'Ole Automation Procedures',1
reconfigure
go
DECLARE @FsObjId INTEGER
DECLARE @Source VARCHAR(4096)
DECLARE @Destination VARCHAR(4096)
SET @Source = '\\PC04HGFD\c\winDSX\images'
SET @Destination= 'C:\images'
--creare OLE Automation instance
EXEC sp_OACreate 'Scripting.FileSystemObject', @FsObjId OUTPUT
--call method of OLE Automation
EXEC sp_OAMethod @FsObjId, 'CopyFolder', NULL, @Source, @Destination
--once you finish copy, destroy object
EXEC sp_OADestroy @FsObjId
GO
I...