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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 I know this isn't exacly sql but...

Author  Topic 

ds12will
Starting Member

21 Posts

Posted - 2009-12-03 : 15:06:16
In a SQL job I'm putting a command to copy files from one area to another. In the command, it's copying all log files....see example below:
mput W:\log\*.log

Is there a way to have it copy files modified within the last day in the command?

I haven't really used command prompts before and don't think you can really use if statements.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-03 : 15:11:05
Check if mput has any switches that you can pass for modified dates. I know xcopy has stuff like that.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

ds12will
Starting Member

21 Posts

Posted - 2009-12-03 : 15:20:53
quote:
Originally posted by tkizer

Check if mput has any switches that you can pass for modified dates. I know xcopy has stuff like that.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."



Seems like a good idea, any site you could suggest I could check with? or any example?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-12-03 : 15:44:17
Google?

http://www.nersc.gov/nusers/resources/hpss/hsi/Doc/ch8/mput.html



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-12-03 : 15:47:59
For Windows commands, I simply specify /? after the command I'm entering. Such as: xcopy /?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-12-03 : 15:50:23
fine...

But I still have a problem with what you are doing

So what you are saying is...that if a file "appears" to be modified...this is meant to drive your process?

Good Luck



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

ds12will
Starting Member

21 Posts

Posted - 2009-12-03 : 15:55:45
quote:
Originally posted by X002548

fine...

But I still have a problem with what you are doing

So what you are saying is...that if a file "appears" to be modified...this is meant to drive your process?

Good Luck



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam




yikes...Basically it will transfer log files from one location to another and I don't want to copy large files that only get updated once a month.

So by having something in the command say "hey this file was last modified less than 24 hours ago lets copy it over"
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2009-12-03 : 16:10:40
The free Windows resource kit ROBOCOPY command is a very good tool for this, even to copy files over a WAN.

Mirror source share to target share for files with a max age of 2 days.
ROBOCOPY \\sourceserver\sourceshare  \\targetserver\targetshare  *.* /COPY:DAT /MIR /MAXAGE:2 /R:10 /W:30 /Z /NP  






CODO ERGO SUM
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-12-03 : 16:28:32
Modified or Created?




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

ds12will
Starting Member

21 Posts

Posted - 2009-12-03 : 16:34:27
quote:
Originally posted by X002548

Modified or Created?




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam





modified
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-12-03 : 16:37:52
I meant what date does ROBOCOPY Look for?

I'm guessing created



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

tripodal
Constraint Violating Yak Guru

259 Posts

Posted - 2009-12-03 : 17:01:08
xcopy has a switch for copying files modified on or after a specified date.

there are a lot of ways to do what you ask. What exactly are you intending as your final goal? 2 copies of all of these files? incremental backup, script to help generate debugging info?
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-12-03 : 19:08:53
[Pet Detective]
Alrighty Then
[/Pet Detective]

THE problem....is that you can have file that's OUT THERE.......FOREVER....and you never deal with it, and IF you MISS it AND it's NEVER been touched.....then it'll stay there

But Hey, that's just me.




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
   

- Advertisement -