Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

copy images from one folder to another folder or comparing files with sql server

$
0
0

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...


Viewing all articles
Browse latest Browse all 4871

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>