Skip to content

Lateralus138/cleantemp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Clean Temp

Logo 1

Clean temporary files and directories in Windows..


About

All about this program and project.

Description

What is this?

This is a console tool for the Windows command line environment that deletes temporary files and directories in %SYSTEMROOT%\temp (System) and %TEMP% (User). Great for use as a scheduled task (Task Scheduler). This works in cmd or PowerShell.

Motivation

Why did I write this?

This helps me automate cleaning my temporary folders. I've been writing scripts to do this for years, this just makes it a tad bit easier; more portable.

Where To Get

Download or build.

You can fork this repository and build yourself or you can download it at the current Releases page.

Change Log

Changes and fixes in 1.1.0.1683399661082 (1.1.0.0)

  • Fixed the wait prompt for skip_prompt.
  • Fixed exception throwing when indexing directories without administrative privileges.
  • Fixed the console mode to correctly display console color.

Usage

Where and how to use this program.

Environment and Information

Where do I use this?

Like any cli tool (or any executable for that matter) this can be used in any available command line program/emulator in Windows like CMD or PowerShell, for example, and should work in most available terminals.

Like any portable program in this can either be placed somewhere in your %PATH% and if not then when your run it you'll need to provide the direct path of the executable.

Example Given

     > & 'C:\Users\<USERNAME>\Bin\cleantemp.exe' /? 
  

Examples

Best methods.

This is best used as a scheduled task via Task Scheduler with the [/P] switch, but you can use it from the command line, shortcut (.lnk), clicked, or from any other program.

Get Help.

In CMD or PowerShell. (with /?, /H, or /HELP). You can also find a screenshot below.

    C:\Windows\System32> cleantemp /?
    
┌────────────────────────────────────────────────┐
│                   Clean Temp                   │
├────────────────────────────────────────────────┤
│ Clean temporary files and directories.         │
├────────────────────────────────────────────────┤
│ cleantemp [/H] [/S] [/U] [/P]                  │
├────────────────────────────────────────────────┤
│ /?,/H,/HELP     This help screen.              │
│ /P,/PROMPT      Skip [Enter] prompts.          │
│ /U,/USER        User temp directory only.      │
│ /S,/SYSTEM      System temp directory only.    │
├────────────────────────────────────────────────┤
│ © 2022 Ian Pride - New Pride Software/Services │
└────────────────────────────────────────────────┘
    
  
CMD Examples.

Good old fashion cmd.exe.

Clean user temp dirctory only.

  
  C:\Windows\System32> cleantemp /U
  
┌────────────────────────────────────────────────┐
│                  Clean Temp                    │
├────────────────────────────────────────────────┤
│ Clean all temporary directories for a user.    │
└────────────────────────────────────────────────┘

┌────────────────────────────────────────────────┐ │ Found user temp directory and enumerating │ │ children files and directories. │ └────────────────────────────────────────────────┘

┌────────────────────────────────────────────────┐ │ Found files and folders in the user temp │ │ directory and attempting to delete. │ └────────────────────────────────────────────────┘

C:\Users\<USERNAME>\AppData\Local\Temp\027bfd2d-276b-4e2c-83b2-5f1d444c3382.tmp is in use by another process. ... Access is denied for C:\Users\<USERNAME>\AppData\Local\Temp\8cd7e51b-f6be-48c9-afd0-e04c6954b9aa.tmp.node C:\Users\<USERNAME>\AppData\Local\Temp\8fccf883-842d-4d9a-a21e-8cbf0b6d9f1f.tmp is in use by another process. ... C:\Users\<USERNAME>\AppData\Local\Temp\qtsingleapp-qBitto-9f54-1-lockfile is in use by another process. C:\Users\<USERNAME>\AppData\Local\Temp\tempoa deleted successfully. C:\Users\<USERNAME>\AppData\Local\Temp\tempob deleted successfully.

PowerShell Examples.

The more powerful PowerShell or PWSH.

Clean system temp dirctory only.

  
  C:\Windows\System32> cleantemp /U
  
┌────────────────────────────────────────────────┐
│                  Clean Temp                    │
├────────────────────────────────────────────────┤
│ Clean all temporary directories for a user.    │
└────────────────────────────────────────────────┘

┌────────────────────────────────────────────────┐ │ Found system temp directory and enumerating │ │ children files and directories. │ └────────────────────────────────────────────────┘

┌────────────────────────────────────────────────┐ │ Found files and folders in the system temp │ │ directory and attempting to delete. │ └────────────────────────────────────────────────┘

C:\WINDOWS\Temp\catalog.json deleted successfully. C:\WINDOWS\Temp\INFERNO2-20220115-1352.log is in use by another process. C:\WINDOWS\Temp\officeclicktorun.exe_streamserver(2022011513515810B8).log is in use by another process.


MD5 Information

This information is generated in a GitHub Action immediately after the successful build of this project.

Current X86 MD5

X86 MD5

Current X64 MD5

X64 MD5


Media

Logo, the icon for this program. logo2 logo2
Help, screenshot of the help screen. logo2 helpscreen

License Info

License Excerpt
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

About

Clean temporary files and directories in Windows.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages