Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6842241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:04:32+00:00 2026-05-27T00:04:32+00:00

My client gave me very diffrent requirement yesterday. I have one folder at server

  • 0

My client gave me very diffrent requirement yesterday.

I have one folder at server where thousands of files are comming daily. He want me to write a logic to check dates of file. If files are there in folder from more than 3 business days (Mon to Friday) then he want me to delete those files

Example : If any file created in folder on Saturday then that file should delete on wednesday because inbetween we have Saturday and Sunday that should not count as business days.

My developemnt enviornment is c# .NET 3.5

I thought i should write custom method.

Please help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:04:33+00:00Added an answer on May 27, 2026 at 12:04 am

    George Duckett solution is the one for you.
    Just to help you I post an example:

    public static class DateExtensions
    {
        public static bool IsBusinessDay(this DateTime date)
        {
            return
                date.DayOfWeek != DayOfWeek.Saturday &&
                date.DayOfWeek != DayOfWeek.Sunday;
        }
        public static int BusinessDaysTo(this DateTime fromDate, DateTime toDate, 
                                         int maxAllowed = 0)
        {
            int ret = 0;
            DateTime dt = fromDate;
            while (dt < toDate)
            {
                if (dt.IsBusinessDay()) ret++;
                if (maxAllowed > 0 && ret == maxAllowed) return ret;
                dt = dt.AddDays(1);
            }
            return ret;
        }
    }
    

    With this you can do something like this:

    DateTime from = DateTime.Now.AddDays(-8);
    int ret = from.BusinessDaysTo(DateTime.Now);
    int ret2 = from.BusinessDaysTo(DateTime.Now.AddDays(5), 8);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to know one thing.. I have a client who has complaint
i have a page where the user can upload files on the server. Due
We have a requirement from a client to protect the database our application uses,
i making a file transfer (server-client) application .. i have two listviewS to explore
I have a client that gave me a .psd file that contains the entire
I wrote small FTP Client Applet which uploads files to FTP Server using Commons
The client connects to the server using GenuineChannels (we are considering switching to DotNetRemoting).
One of our clients has logged a very strange issue with us- We launched
I want to deliver events from a server application to multiple clients. Since I'm
I have a SQL Server that holds a lot of data. An application, running

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.