My desktop is always a mess. I constantly download files there and forget all about them.

Every now and then I copy files into sub directories so my desktop looks sane for a day or two before it gets out of control again.

Why don’t I write a script that I can schedule to do this for me. Then my desktop will always be tidy.

I have written a few simple batch scripts, but of course the best scripting language out there at the moment is PowerShell. Lets use that.

Windows provides a nice little utility for writing scripts called the Windows PowerShell ISE, so lets start by loading that up.

PS has lots of help included to help you, just run Get-Help [name of ps command]

To move files you can use Move-Item which works very similar to copy, specify source and destination. In my case I moved files based on their file extension.

Move-Item *.pdf folder

Now all I need to do is schedule this script to run either every day or so, or maybe every time I login or switch my computer on.

PowerShell can do lots more interesting things which hopefully I will blog about soon.

This post has already been read 1285 times!

Simon Foster on GithubSimon Foster on LinkedinSimon Foster on Twitter
Simon Foster
Web Developer
I have worked in SysAdmin and IT Management but now work as a Web Developer. I love everything IT related and I am trying to learn as much as I can especially about DevOps. Why not follow me on twitter?