Monthly Archives: December 2015

Empty recycle bin for all users on Windows

Before I worked at a Linux only company, but since I changed job I’ve been working some with Windows servers. Something that got me frustrated last night was that somebody had put large files in the recycle bin but not emptied it. This made the server almost run out of space, so after a bit googling I found out that you actually can empty the recycle bin for all users.

This is a easy way to do this:

rd /s c:\$Recycle.Bin
rd /s c:\recycler

If you have multiple drives just change c:\ accordingly. And of course, answer yes (y) to the question that pops up.

A big thanks to the lifehacker blog for posting this.

Get sizes of database and tables in specific database

Often in my day to day work I need to figure out which database on a particular database that take up all the space, one easy way to do this is the following command that you run in your MySQL prompt or preferred MySQL manager:

´┐╝SELECT table_schema "Database Name", 
       SUM(data_length + index_length) / (1024 * 1024) "Database Size in MB" 
       FROM information_schema.TABLES GROUP BY table_schema;

If you need to know which table in a database run the following query:

SELECT table_name AS "Tables", 
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB" 
FROM information_schema.TABLES 
WHERE table_schema = "test"
ORDER BY (data_length + index_length) DESC;

This was inspired from: StackOverflow – How to get the sizes of the tables of a mysql database?