Revision 5: Cleanup & Attributes
Master folder deletion and file attribute modification for better system housekeeping.
Start Interactive LessonSystem maintenance is critical — removing unnecessary files and protecting important ones. In this revision, you'll combine the rd (remove directory) and attrib (attributes) commands to clean up your workspace and secure key files.
Try the command
Delete a cache folder with all contents automatically!
Challenge 1: Recursive Cleanup
Use rd with /S (recursive) and /Q (quiet mode) to delete a cache folder and all its contents in one command. This is essential for maintenance — preventing confirmation prompts lets you automate cleanup tasks.
The /S flag ensures recursive deletion — all subdirectories and files inside cache are removed. The /Q flag suppresses confirmation dialogs, perfect for batch operations.
Challenge 2: File Protection
Now protect an important file by making it read-only using the attrib command. This prevents accidental modifications.
Try the command
Make a configuration file read-only!
The R (Read-Only) attribute in the directory listing shows that settings.ini is now protected. Attempting to delete or modify it will fail until you remove this attribute with attrib -R.
Knowledge Check
1 / 4What does the /S flag do with the RD command?
References
These documentation links provide authoritative details for the commands used in this article.
Up Next
Create a small text or batch file in CMD without Notepad: start copy con, enter each line, then press Ctrl+Z and Enter to save.