web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Files in Temp directory on AOS server

(0) ShareShare
ReportReport
Posted on by 11,633

Hi All,

Our client is facing an issue where so many files on daily basis is getting created in Temp folder (C:\Users\AOSServiceAccount\AppData\Local\Temp) on AOS server machine, so due to this, Temp folder size has reached around 40 GB. Is there any setting in AX through which you can redirect the temp files to be created somewhere else, possibly in a different drive ? There are so many csv and pdf files which is occupying the space. Can someone please let me know how can I schedule the deletion of these files based on datetime stamp and also tell me if it is safe to delete these files while the Production system is running and users are connected?

Thanks,

Baber.

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    237,801 Most Valuable Professional on at

    The location of TEMP folder is defined in Windows environmental variables and you change it there.

    You can use Windows Scheduler, for instance, to run scheduled actions.

    When you can delete these files depends on how they're used. Analyze where these .csv and .pdf files come from and then check if they shouldn't be deleted automatically. Maybe there left there because developers forgot to add logic to clean them up.

  • syed baber Profile Picture
    11,633 on at

    Thanks Martin for your prompt response. The environment variables Temp has the following path:

    %USERPROFILE%\AppData\Local\Temp. Which

    If I specify a different path here for example in D: drive, then the files will be saved there, right ?

    Thanks,

    Baber.

  • Suggested answer
    guk1964 Profile Picture
    10,888 on at

    You might find this earlier post a useful tip community.dynamics.com/.../76105 and this one for cleaning up attachment temp files blogs.msdn.microsoft.com/.../delete-temp-files-when-sending-mails-with-attached-files.

    Also consider client files. By default, AX Client temporary files are saved in the folder: C:\Documents and Settings\<username>\Local Settings\Temp. This folder is used because the logged-in user will always have the necessary rights to read and write files to this folder. Windows stores temporary files from a variety of applications in this folder, so to maintain a location where only AX Client temporary files are stored, so similally as Martin suggests for the AOS, specify a different folder..

  • Sukrut Parab Profile Picture
    71,710 Moderator on at

    If you are generating any temp files in any of your process then It's alwways good to clean those up once you are done. I think changing drive may help help you if you don't have  any space concerns but instead you / your  Dev should revisit your functionalities and whereever temp files are used they should be cleaned up after process has been done.

  • MYGz Profile Picture
    2,162 on at

    You can get the files based on date range in PowerShell like so:

    [datetime]$start = '2018-04-01 00:00:00'
    [datetime]$end = '2018-05-01 00:00:00'
    Get-ChildItem "C:\Users\PC- 1\Downloads" | Where-Object { $_.LastWriteTime -gt $start -and $_.LastWriteTime -lt $end }


    If you want to remove the files in above range just pipe the last command to Remove-Item like so:

    Get-ChildItem -Path "C:\Users\PC- 1\Downloads" | Where-Object { $_.LastWriteTime -gt $start -and $_.LastWriteTime -lt $end } | Remove-Item
  • syed baber Profile Picture
    11,633 on at

    Thanks Martin. I have found the process which is responsible for creating pdf and csv files in Temp directory.  I will add the code to delete these files after the email is sent out.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans