Our application saves report data in a user’s %appdata%/local/temp directory using DevExpress report libraries. We don’t have control over this process. Usually, this works fine, but we’ve noticed a problem with one of our clients who is running Windows Server 2016. At 3pm every day, a folder with an incremented number in the user Temp directory (e.g. %appdata%/local/temp/96) is deleted, and the user needs to start a new windows session or open SQL Server Mgmt studio to recover the folder.
We’ve checked their scheduled tasks, and there doesn’t seem to be any explanation for the deletion. Their weekly scheduled Disk Clean up doesn’t run at 3pm, and they don’t have any CCleaner-style applications installed.
We haven’t seen this issue with any other clients.
What could be causing this deletion, and how can we prevent it from happening?
3 Answers
Introduction
The temporary folder in the user’s %appdata% directory is a crucial element in many applications that require the storage of temporary files. However, we have received reports from one of our clients that the folder is being removed at a specific time every day. This has caused a lot of inconvenience for the client as they need to start a new windows session or open SQL Server Mgmt studio to recover the folder. In this blog post, we will explore the possible causes of this deletion and how we can prevent it from happening.
Possible Causes of the Deletion
There are several possible causes of the deletion of the temporary folder in the user’s %appdata% directory. One of the most common causes is the presence of a scheduled task that is set to delete the folder at a specific time every day. However, as we have already checked the client’s scheduled tasks and found no explanation for the deletion, we need to consider other possible causes.
Another possible cause of the deletion is a disk cleanup utility that is set to run at a specific time every day. However, as the client’s weekly scheduled Disk Clean up doesn’t run at 3pm, we can rule out this possibility as well.
A third possible cause of the deletion is the presence of a third-party application that is deleting the folder. However, as the client doesn’t have any CCleaner-style applications installed, we can also rule out this possibility.
Possible Solutions
Now that we have ruled out the most common causes of the deletion, we need to explore other possible solutions to prevent the deletion from happening. One possible solution is to change the location of the temporary folder to a different directory that is not being deleted. However, this may not be feasible in all cases, especially if the application is using DevExpress report libraries that require the use of the user’s %appdata% directory.
Another possible solution is to create a backup of the temporary folder at regular intervals. This can be done using a script that runs at a specific time every day and copies the contents of the temporary folder to a different location. This way, even if the original folder is deleted, the user can still recover the data from the backup.
Another possible solution is to create a new temporary folder at a different location every day. This can be done using a script that runs at a specific time every day and creates a new folder with an incremented number in a different directory. This way, even if the original folder is deleted, the user can still access the data from the new folder.
Conclusion
In conclusion, the deletion of the temporary folder in the user’s %appdata% directory can be caused by several factors, including scheduled tasks, disk cleanup utilities, and third-party applications. However, if none of these factors are present, it can be difficult to determine the cause of the deletion. To prevent the deletion from happening, we can consider changing the location of the temporary folder, creating a backup of the folder at regular intervals, or creating a new temporary folder at a different location every day. By implementing these solutions, we can ensure that the user’s data is always safe and accessible.
There are a few potential causes for this behavior:
- It’s possible that there is a scheduled task or script running on the client’s Windows Server 2016 machine that is deleting the temp folder. You can check the Task Scheduler to see if there are any tasks configured to run at 3pm that could be causing this.
- It’s also possible that the temp folder is being deleted by a third-party application or service. For example, some antivirus or disk cleanup tools may delete temporary files on a regular basis. You can check the list of installed programs on the client’s machine to see if there are any such tools that might be causing the issue.
- Another possibility is that the temp folder is being deleted due to a permissions issue. If the permissions on the temp folder are set incorrectly, it may not be possible for your application to write to the folder, and it may be deleted as a result. You can check the permissions on the temp folder to see if this is the case.
To stop the temp folder from being deleted, you could try one of the following approaches:
- If you have identified a scheduled task or script that is causing the issue, you can modify the task or script to stop deleting the temp folder.
- If a third-party application or service is causing the issue, you may be able to configure the application or service to stop deleting the temp folder.
- If the permissions on the temp folder are causing the issue, you can try modifying the permissions on the folder to allow your application to write to it.
It’s also a good idea to try to identify the root cause of the issue, as this will help you come up with a more permanent solution. You may want to consider working with your client and/or a technical support specialist to troubleshoot the issue and find a solution.
In summary, there are a few potential causes for the temp folder in the user’s %appdata% directory being deleted on a client’s Windows Server 2016 machine, including a scheduled task or script, a third-party application or service, or a permissions issue. To stop the temp folder from being deleted, you can try modifying the relevant task or script, configuring the third-party application or service, or modifying the permissions on the temp folder. It’s also a good idea to try to identify the root cause of the issue, as this will help you come up with a more permanent solution. If you continue to experience difficulty, you may want to consider working with your client and/or a technical support specialist to troubleshoot the issue and find a resolution.
If you want to keep track of which application is responsible for deleting a folder, you can use Process Monitor to monitor the system and log the relevant information.