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 4076988
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:29:40+00:00 2026-05-20T17:29:40+00:00

Is it safe to use something like this to ensure that a directory isn’t

  • 0

Is it safe to use something like this to ensure that a directory isn’t currently being written to?

Dim ImportDir As New DirectoryInfo("C:\MyPath\")
If DateDiff(DateInterval.Minute, ImportDir.LastWriteTime, Now) < 10 Then
    Exit Sub
End If

I’m processing images which can be up to 10MB so my main concern is that I’m not sure whether the LastWriteTime property (which presumably references the filesystem ‘last modified’ meta data) is updated when the first, last or every byte of a file is written to disk.

Files will generally be uploaded via IIS7 FTP to an NTFS Filesystem on a Windows 2008 server. If it’s filesystem-dependant though it would be good to also know which filsystems update when.

EDIT: I’d hoped that this could be used to simplify the programme by ensuring that the whole directory was processed at once. In the end I decided to rethink that since the workarounds are messier and less reliable than the one I was trying to avoid! Cheers for the answers though

  • 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-20T17:29:40+00:00Added an answer on May 20, 2026 at 5:29 pm

    Not at all. LastWriteTime is updated after writing, not while writing. You need to rely on whatever program is doing the uploading to put a lock on the file. Any decent one does. So that trying to open the file with, say, the FileStream constructor with FileShare.Read or FileShare.None will throw an IOException. This will almost always work.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it safe to do something like this in Node.js/Express.js? // use Object.create(null) so
Would a Python script like this be safe to use? There would be a
I'm trying to build an object that looks something like this: public class MyObject
Is it XSS safe to do something like this in jQuery? <html> ... <input
Is the June 2009 WPF Toolkit safe to use in applications that will be
I would like to know if it is safe to use the following code
foreach(var someDisposableObject in listOfDisposableObjects) { //some code someDisposableObject.Dispose(); //current code contains something like this.
The issue, of course, is that ruby symbols don't like hyphens. So something like
There is this DB-connection-like object that my web application will need. It is pretty
I have a Queue object that I need to ensure is thread-safe. Would it

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.