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

  • Home
  • SEARCH
  • 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 274309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:35:24+00:00 2026-05-12T00:35:24+00:00

When an application saves a file, a typical model is to save the file

  • 0

When an application saves a file, a typical model is to save the file to a temporary location, then move the temporary file to the final location. In some cases that “move” becomes “replace”. In pseudo code:

Save temp file;
if final file exists
   delete final file;
move temp file to final filename;

There’s a window in there where the delete might succeed, but the move may not, so you can handle that by something like :

Save temp file;
if final file exists
   move final file to parking lot
move temp file to final filename;
if move succeeded       
   delete previous final file. 
else
   restore previous final file. 

Now to my questions:

  1. is it preferred to save the temporary file to a temporary directory, and then move it, as opposed to saving the temporary file to the final directory? (if so, why?)

  2. Is there a difference in attributes and permissions on a file that is first saved to a temp dir, then moved to the final file in a different directory, as compared to a file that is saved to a temp file in the final directory, and then renamed within the directory?

  3. If the answers to both are YES, then how can I do the preferred thing while getting the appropriate ACL on file which was first saved to a temporary directory and then moved to a final directory?

  • 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-12T00:35:25+00:00Added an answer on May 12, 2026 at 12:35 am

    Create a temp file in the temp folder if it is just a temporary file. Otherwise, create it in its final destination.

    Caveats:

    1) This may not work if the final destination is a ‘pickup’ folder (unless the ‘pickup’ process checks for locked files (which it should))

    2) The final destination has special permissions that have to be created in code and applied before being able to move to the final destination.

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

Sidebar

Related Questions

I've created my own application in VB.NET that saves its documents into a file
We are writing a search application that saves the search criteria to session state
I currently store a serialized XML file in the application directory that contains all
I considering writing an application in C#/.NET that will programmatically alter an XML file
I am trying to upload a file via a form and then save in
Our Windows Forms application by default saves data files in a user's 'My Documents'
I have a problem in a Windows Forms application with Bitmap.Save failing when I
I need to save a user's login information in encrypted form for this application
I'm trying to implement a Load / Save function for a Windows Forms application.
I wish to store a single variable in my application that will be saved

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.