Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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
217,557 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