Move a directory and its contents up several levels

Posted on

Problem :

I have a directory with text files in /user/data/tutorial/texts/ and I’d like to move the (sub)directory Folder2/ with all of its contents to /user/.

How should I go about this using unix commands?

Solution :

The mv command moves files and directories between directories.

Assuming that you have write access to both /user (for creating new files and directories therein) and /user/data/tutorial/texts (for deleting the directory Folder2), then the following command will do what you ask for:

mv /user/data/tutorial/texts/Folder2 /user

Leave a Reply

Your email address will not be published. Required fields are marked *