-2

I'm unfamiliar with creating batch files. I really don't get how they work or what they can do. What I do know is how to write a c# program.

If I want to have an automated process that runs probably once a day to delete files older than 30 days, would it be better to make a batch script, or some sort of task that runs the c# program?

Should the program keep track of files it knows will expire tomorrow and just delete by name? Or should it scan the whole folder every day? Seems like a waste to do that, but it makes it very simple.

I know it can be done both ways and there's a lot of material on both, but what I really want to know is what's the difference?

Alex
  • 141
  • 1
  • 11
  • If the script runs once a day, it'd have to be a pretty large folder to warrant worrying about performance. If your preferred tool is .NET, use that. Powershell is probably the 'correct' tool if there is such a thing. – Troels Larsen Feb 17 '16 at 23:05
  • 2
    I'm voting to close this question as off-topic because this isn't a programming question. – John3136 Feb 17 '16 at 23:06

1 Answers1

4

I'm unfamiliar with creating batch files. I really don't get how they work or what they can do. What I do know is how to write a c# program.

Then write a C# program. Either technology can work, .bat files are limited (though PowerShell is not), so use the technology you're comfortable with. Write the program in C# and schedule it to run periodically using Schedule Tasks.

Eric J.
  • 147,927
  • 63
  • 340
  • 553