Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Copy directory information to text file

Mar 17 2011 2:36PM by Madhivanan   

One one my friends asked mw if it is possible to copy the directory structure information with size to a text file. This can be done via any front end application. If you want to do this from SQL Server you can make use of system procedure xp_cmdshell

Consider the follwoing code

DECLARE @cmd sysname
SET @cmd = 'Dir F:\ > f:\dir_out.txt'
EXEC master..xp_cmdshell @cmd

The above code will copy the directory structure information of F drive to the text file named dir_out.txt. The sysmbol > is in this usage used to copy to a specified file. If you want to copy a file content from one place to another you can use that.

Tags: t-sql, sql_server, sqlserver, tsql, BRH, xp_cmdshell, directory,


Madhivanan
3 · 39% · 12419
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

1  Comments  

  • This requires that you enable xpcmdshell which increases the attackable surface area of your SQL Server installation. I would advise against it. Use PowerShell to do scripting tasks that involve the file system...if you absolutely must access the file system through T-SQL use the SQL CLR instead and have xpcmdshell disabled.

    commented on Apr 8 2011 3:47PM
    orlando.p.colamatteo
    2891 · 0% · 2

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]