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 Console Foundations Getting Started with the Console Moving and Deleting Files

Move Directory

How can I move the directory. Jim said that I can move directory to other above or below directory but he did not do that in the video.

1 Answer

Steven Parker
Steven Parker
229,744 Points

I don't think the instructor actually makes that comment in the video, but yes you can move entire directories, very much like moving single files:

$ mkdir files
$ mkdir uploads
$ mv uploads files   # the directory "uploads" is now inside (below) the directory "files"

Any files or other directories that are inside the directory that you move keep their place within it, so their path also changes:

cat sample/products.txt       # show a text file
mv sample docs                # move the directory into another directory
cat docs/sample/products.txt  # that same file moved also