Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2005 > SQL Server 2005
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2005 General discussion of SQL Server *2005* version only.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2005 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 24th, 2008, 08:20 AM
Authorized User
 
Join Date: Dec 2006
Location: chennai, tn, India.
Posts: 62
Thanks: 0
Thanked 0 Times in 0 Posts
Default XP shell commands...

Hi,

I need a code which should look for the particular folder (d:\test)
and find out the COUNT of the files (not the directory), if it has >= 3 files, the system should compare with my predefined date, something 2008-07-09 with the filedates and accordingly i should process...further.

So is there any way in TSQL where i can find out the count of the files and compare predefined date with the file date in the archive folder (predefined > filedate)



Thanks,
Chandra
__________________
Thanks,
Chandra
Reply With Quote
  #2 (permalink)  
Old July 24th, 2008, 11:16 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Is there a reason you are looking to do this in SQL? This is not such a SQL friendly task. Sure, it could probably be done, but it seems like the wrong tool for the job. You could create some .NET code that does this and make it a SQL CLR stored procedure if you really want to "run" it from SQL. Otherwise, use a better tool such as a command line app.

-Peter
compiledthoughts.com
Reply With Quote
  #3 (permalink)  
Old July 24th, 2008, 06:21 PM
Friend of Wrox
Points: 1,536, Level: 15
Points: 1,536, Level: 15 Points: 1,536, Level: 15 Points: 1,536, Level: 15
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2006
Location: , MI, USA.
Posts: 475
Thanks: 0
Thanked 9 Times in 9 Posts
Default

So, if you're using xp_CmdShell already, by not use DIR with the /s option to find the diretory. Then use master.dbo.xp_Dirtree 'directoryname',1,1 to examine the file names.

--Jeff Moden
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ABOUT AT COMMANDS bobwith5 Visual Basic 2005 Basics 1 October 31st, 2007 02:25 PM
Help-Implementing a unix shell to run commands ssimkhan Java Basics 1 June 15th, 2007 06:43 AM
Help-Implementing a unix shell to run commands ssimkhan Pro Java 0 June 7th, 2007 04:58 AM
Using 2 SQL commands attipa Classic ASP Databases 2 September 20th, 2003 05:23 PM
SendKey commands charlie3 VBScript 1 July 6th, 2003 02:30 PM



All times are GMT -4. The time now is 12:28 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.