Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

I'm having fun with Git

I've just started the Git basics course. I'm having a bit of fun drawing on what I learned from the Console Basics course to Git.

I see some of the commands are similar to that used on the Treehouse Console. Cool!

I've already downloaded Git and it's integrated itself into my system nicely. But I'm hitting a bit of a block moving around my system in the Bash terminal.

If I remember rightly, the course notes on the video tell us that we need to use the

cd foldername 

to change your location to that directory. But what if that folder name has more than one word. like "digital medial" for example.

I type that in and I get a response like this

sh: cd: digital:  directory does not exist

Similarly if I want to delete a folder from my space I type... for example...

rm folderName

And instead I get this

rm:  'foldername' is a directory.  

This is the command that allows to delete files and folders right? What am I missing?

Thanks :-)

2 Answers

When you need to cd into a directory with a space or special character, you need to escape that character

ls
>Example Directory With A Space
cd Example\ Directory\ With\ A\ Space

To delete folders, you can use rm -rf

ls
>Example Directory
rm -rf Example\ Directory
Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

Aha! Bingo! That worked thanks for that.

I like to have folders with clear names so I can keep things organised so I find them.

Do you have anything for the RM problem? I can't thuink of anything that would be stopping that yet. :-)

Did my second part of the answer not solve that? Note the -rf

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

I see it now, yes. Thanks for that. It wasn't up there before :-)

James Barnett
James Barnett
39,199 Points

The traditional solution to this is to use quotes or tab completion.

mkdir "test dir"
cd "test dir"
rmdir "test dir"