Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Mathias
Posting Yak Master
119 Posts |
Posted - 2004-11-03 : 07:15:14
|
| I get many uploads coming into one single directory. I plan to create a table where the first field would containt the source_destination another with the Final_destination. Examplec:\tempdata\*.txt as source_destinationc:\tempdata\d1\ as final_destinationIs there any way to automate it? I would like to kill the first file after the copy. The table is dynamic (I get new request every week).Thanks, Paul |
|
|
Soulweaver
Starting Member
18 Posts |
Posted - 2004-11-03 : 07:26:51
|
| the only way i'm aware of of doing file management type stuff in SQL server is to use the XP_CMDSHELL stored procedure.you can use a normal dos 'MOVE' command to move the file, for exampleexec master..xp_cmdshell "move c:\tempdata\*.txt c:\tempdata\d1"regardsTiaanps. you need quite a bit of rights to run XP_CMDSHELL, however, if you need it, i can help you setup the SQLAGENT proxy account.pps. XP_CMDSHELL is dangerous, you can break many many things with it.-----------------------Black Holes exist where God divided by Zero----------------------- |
 |
|
|
Soulweaver
Starting Member
18 Posts |
Posted - 2004-11-03 : 07:29:58
|
| more info you can build up the exec string from your table and then exec it : eg : set @sqlstring = @sqlstring + @itempath + '\*' + @itemextension + '" '+ @diroptionsrun with exec (@sqlstring)-----------------------Black Holes exist where God divided by Zero----------------------- |
 |
|
|
|
|
|