Back to Blog
Arnošt Havelka

Revision 5: Cleanup & Attributes

Master folder deletion and file attribute modification for better system housekeeping.

Start Interactive Lesson
Revision 5: Cleanup & Attributes

System 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!

Build the command
rd
rdRemoves a directory (RD or RMDIR).
Terminal
C:\Users\User>rd /S /Q cache

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.

Command Prompt
C:\Users\User>rd /S /Q cache

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!

Build the command
attrib
Terminal
C:\Users\User>attrib +R settings.ini
Command Prompt
C:\Users\User>attrib +R settings.ini

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 / 4

What 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

Opening Files in a Text Editor

Learn to open and edit files with Notepad directly from the command line.