Tag Archives: folder

How to Delete a Folder using the Windows Command Line Software & Sites 30 MAY 2013

blue-folder-iconIf you find yourself stuck in the Windows Command line environment and have an itching desire to delete some of your folders, here is the command to do it: RMDIR.

If like me you are one of the older guys reading this, then you would probably have fingered the old (DOS) DELTREE as the command to use, but seeing as this was technically replaced ages ago, the correct answer is in fact RMDIR, which is responsible for removing a directory (and with switches, an entire directory tree, folders, files and all!).

Given a folder called ‘annoying’, you can banish it by running:

rmdir c:\annoying

Of course this will fail if ‘annoying’ isn’t empty. To get around this and delete the entire directory tree, in other words a recursive file and folder delete, we employ the /s switch:

rmdir /s c:\annoying

And if we don’t want to be prompted or bothered again by what is about to happen, we force the command into quiet mode with the /q switch:

rmdir /s /q c:\annoying

Nifty.

Related Link: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/rmdir.mspx

Ubuntu: Get the Size of a Directory via the Terminal CodeUnit 29 JUL 2011

When using the terminal to navigate your way through your Ubuntu or any other Linux distro, it is actually pretty easy to quickly see how big a particular directory or folder is in terms of size.

The command to use is du, short for Disk Usage. It’s main purpose is to gather and summarize how much of your disk space is being used up by either files or directories in the Linux system.

Basic usage (with the -h switch to report back the size in easy to understand user friendly units) is:

du -h /home/craiglotter

This will recursively list all folders and their respective sizes as well as the total size of the selected folder in the appropriate size unit.

Adding the -s for summarize switch will return only the total file size for the selected directory (this is still recursive in case you were wondering).

du -sh /home/craiglotter

If you want the size for all files in the current directory also displayed, add an asterisk to your query. Similarly, if you want only files of a specific type listed with their respective sizes, modify the asterisk with the desired file extension.

In practice:

du -sh /home/craiglotter *

or

du -sh /home/craiglotter *.txt

Nifty.

Ubuntu: Nicest Way to List a Folder’s Contents from the Terminal CodeUnit 06 AUG 2010

This short little note is intended entirely for my own usage because believe it or not, I am somehow forever forgetting the switches needed to make the bog standard list (ls) function output something that I can easily ready.

ls -l -h -a

There. That will help me in the future I’m sure!

In case you are wondering which switches I have now employed, the -l indicates a long listing, in other words all files and folders are listing one below the other, with a complete set of attribute data next to the file name. The -h forces a human readable print out of the file size variable – in other words 1024 will become 1K. Finally the -a simply forces ls to show us all hidden files and folders.

Truly, I feel like an idiot for even recording this! (shame)

Ubuntu Keyboard/Mouse Shortcut: Folder Icon Zoom CodeUnit 03 JAN 2010

Probably not an Earth-shattering Ubuntu keyboard/mouse combo shortcut for today’s CodeUnit post, but it is quite a useful one to know and it is pretty widely adopted as a kind of a standard, particularly seeing as Windows also allows for the same kind of zooming using the same keyboard/mouse combo sequence.

Anyway, what I’m talking about revolves around Ubuntu’s folder listings and more importantly the files kept inside of any particular folder. Now when bringing up a folder view you’ll notice the drop-down list on the right of the toolbar that holds the various view items which can be applied to the current folder view. To the left of that is a magnifying glass and the currently applied level of ‘zoom’ which affects how enlarged the icons below actually appear.

Now obviously you can control the zoom level by moving the mouse and clicking on the magnifying glass but there is in fact a faster way of achieving this and that is through the use of today’s keyboard/mouse combo shortcut.

Hold down the Ctrl button on your keyboard and use the mouse wheel to scroll either up or down. You’ll notice that by scrolling up you are in fact enlarging the icon view while scrolling down is actually reducing the zoom level.

So like I said, silly, but not entirely useless to know. :P