Moving multiple files from current folder to parent folder in Linux

People who use shell to install packages or application in their Linux servers usually need to keep this command handy. Every time they download and unzip a folder, they are in a position to move all those files to a parent directory they already created.

For example you download wordpress application and extract it, but those files are extracted in another folder that comes up with the zip package. What you need to do at this point is to move all those files from that particular folder to your parent directory which you usually created and planned to host. In most cases it will be your Application root folder.

Consider a scenario where you are in folderX, you download a package file and extract it but instead of extracting it directly in folderX, it creates another native folder that comes up with package like folderY. So all those extracted files are in path /folderX/folderY/ 🙁 thats bad !!!

Run this simple move file command outside the folderY, you need to be in folderX when you run !

mv folderY/* .

The above command will move all the files and folders inside folderY to folderX 🙂 That works like a charm! Yeah try it. Always ensure to be careful while running commands like mv, rm. If you don’t give the correct part, things will mess up and you end up doing the operation at wrong place.


Also published on Medium.

Author: Sankaranand

I'm a Web Strategist & Agile Project Manager with an Engineering in Information Technology. I specialise in creating Strategy for The Web and developing websites for businesses. I also blog about technology and life.

Leave a Reply

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