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 |
jbates99
Constraint Violating Yak Guru
396 Posts |
Posted - 2011-03-22 : 18:29:06
|
Hi experts,I need to move files that have a .msg extension AND are > 30 days old (based on the last-changed date) to a certain folder.Is it possible to do this in a File System Task .... or will I need a ForEach Loop or possibly a Script Task?I guess my main question is can I accomplish the qualified moves with a File System Task?Thanks, John |
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2011-03-22 : 19:05:27
|
How 'bout the DOS MOVE, XCOPY or COPY command? |
|
|
jbates99
Constraint Violating Yak Guru
396 Posts |
Posted - 2011-03-22 : 21:10:37
|
Thanks for the idea, Russell.Hmmm, I wanted a technique that's more SQL Server oriented but sure, I can use those commands.Which task would I use them in?John |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-03-22 : 21:59:28
|
You can do this in a SQL Agent job with an Operating System command step. You can also use xp_cmdshell in a SQL batch, both standalone or in a T-SQL job step.You should also take a look at the "forfiles" command, you should be able to move the files using just that command. |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2011-03-22 : 22:42:21
|
You could use the ROBOCOPY command: ROBOCOPY sourcepath destinationpath *.msg /MOV /MINLAD:30 CODO ERGO SUM |
|
|
jbates99
Constraint Violating Yak Guru
396 Posts |
Posted - 2011-03-23 : 10:25:38
|
Thanks for the good ideas, folks!John |
|
|
jbates99
Constraint Violating Yak Guru
396 Posts |
Posted - 2011-03-23 : 22:41:42
|
Thanks, John |
|
|
|
|
|