Clean Up Old Desktop Items Quickly Through Command Prompt

Untitled 1 Copy

Your desktop is probably the first place to get cluttered. Without a download manager, most files end up on the desktop alongside text documents, pictures, etc. for easy access at any time. A problem can quickly arise when your window is nearing it’s capacity but you still want to add more items!

Instead of dragging whole sections into a folder or deleting random files just to make room, consider using a batch file to move the oldest items away and out into a separate folder.

Commands For Moving Old Desktop Files


ROBOCOPY C:\Source C:\Destination /move /minage:7

So what do each of these commands do and how do you customize it to fit your own system?

ROBOCOPY: This stands for Robust file copy. We use this to do the copying procedure.
C:\Source: This is the source of where ROBOCOPY will look to do the move from.
C:\Destination: ROBOCOPY will move the files to this location and away from the Source.
/move: Although ROBOCOPY is a copy command, we can add this switch to make it do a move operation instead.
/minage: This stands for Minimum age and the number following this switch tells the function to exclude files newer than that many days. In other words, for this example, it will tell the move operation to only move files older than the specified number of days.

Here are a few examples of how you could use this batch file:

ROBOCOPY %userprofile%\Desktop C:\OLD-DESKTOP-FILES /move /minage:30

The above commands will move desktop files older than 30 days out of their directory and into a folder on the C drive called OLD-DESKTOP-FILES.

ROBOCOPY %userprofile%\Downloads C:\OLD-DOWNLOADED-FILES /move /minage:30

This is a nice set of commands to clean up your Downloads folder.

How To Run Commands

There are two ways I’d recommend running these commands. The first is with a pre-made batch file and the second is using the command prompt directly.

Using a Batch File

Open a notepad program and enter the command you want to use. For example, pick one of the above commands, or write one yourself, and enter it in the notepad program.


Save the program as Filename.bat. Ensure you pick All types in the Save as type dropdown. Now just run the batch file and you’re on your way to a less cluttered area.

Using Command Prompt

Because a batch file is simply a command that can be executed like a program launch, we can simply run our commands right from the prompt.


I recommend the batch file method so you can run it with ease whenever you like and not have to remember the command or refer to a document to type it back up.


Keep your desktop and folders from getting cluttered by moving out the old files with ease. Whether you use the command prompt directly or create a batch file, you’ll find your folders get cleaned up much easier than they would otherwise.

Last updated on 03 February, 2022

The above article may contain affiliate links which help support Guiding Tech. However, it does not affect our editorial integrity. The content remains unbiased and authentic.