Sql Server 文件夹 文件的操作

--查看系统配置
select * from sys.configurations
go

exec sp_configure 'show advanced options',1  --开启服务
reconfigure --重新配置
go

exec sp_configure 'xp_cmdshell',1    --开启服务
reconfigure
go

exec xp_cmdshell 'mkdir D:\tt' --创建文件夹  D:\tt文件目录

exec xp_cmdshell 'echo D:\test.txt' 

exec xp_cmdshell   'copy   D:\tt\souceFile.txt   D:\ '          --复制到D盘,并且已源文件名称产生
exec xp_cmdshell   'copy   D:\tt\souceFile.txt   D:\target.txt ' -- 复制到D盘,但是已新的文件名保存
exec xp_cmdshell   'ren    D:\oldfilename.txt,newfilename.txt ' --更改文件名
exec xp_cmdshell   'del    D:\newfilename.txt '  --删除文件
exec xp_cmdshell   'rd     D:\tt /s/q'  --删除文件夹

你可能感兴趣的:(Sql Server 文件夹 文件的操作)