*! version 1.1 01Sep2025 Wu LiangHai(AHUT)/Wu HanYan(NUAA)

Title

cleandisk -- Clean disk space by removing temporary and unnecessary files

Syntax

cleandisk
[,
options]

Main
drives(string) specify drives to clean (e.g., "c d e")

temponly clean temporary files only

quietly run in silent mode

exit exit Stata automatically after cleaning

Description

cleandisk is a utility command that helps clean up disk space by removing temporary and unnecessary files from specified drives.
By default, it cleans all default drives (C, D, E, F) unless specified otherwise.

The command provides progress information and estimated remaining time during the cleaning process, offering a better user experience.

The command is particularly useful when working with large datasets or when disk space becomes limited.

Options

Main

drives(string) specifies which drives to clean. Separate multiple drives with spaces.
The default is to clean all default drives (C, D, E, F).

temponly specifies that only temporary files should be cleaned, leaving other files untouched.

quietly runs the command in silent mode without displaying any output.

exit automatically exits Stata after the cleaning process is completed. This is useful for batch processing or automated scripts.

Examples

Basic usage (clean all default drives C, D, E, F)

. cleandisk

Clean specific drives (C and D only)

. cleandisk, drives("c d")

Clean temporary files only on all default drives

. cleandisk, temponly

Run in silent mode (no output displayed)

. cleandisk, quietly

Clean and automatically exit Stata

. cleandisk, exit

Clean specific drives, show progress, and exit Stata afterwards

. cleandisk, drives("c d") exit

Run full disk cleaning in silent mode and exit

. cleandisk, quietly exit

Authors

Wu Lianghai, Chen Liwen

School of Business, Anhui University of Technology(AHUT)

Ma'anshan, China

agd2010@yeah.net

2184844526@qq.com

Wu Hanyan

School of Economics and Management, Nanjing University of Aeronautics and Astronautics(NUAA)

Nanjing, China

2325476320@qq.com

Ma Defang

Capital Normal University(CNU)

6346@cnu.edu.cn