Moving folder and subfolder to another path

I need to move my folder with many subfolders to another path.

I’m using putty and this is what I tried: MV -r fromflderpath tofolderpath

What am I doing wrong?

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

The mv command doesn’t have an -R flag, it moves folders recursively:

sudo mv fromPath/ toPath/

Edit

If you want a file not to be replaced, use the -i for being prompted in case a file with the same name exists.

Solution 2

For those trying to move folder, on Ubuntu using Putty, just use the following command:

sudo mv /fromPath/ /toPath/

for example:

sudo mv /root/folder1 /home/folder2/

“/” in the end means you are going to move folder1 inside folder2

If you don’t, you will get “no such file or directory”

Solution 3

This worked for me:

mv src_folder target_folder/src_folder

i.e. not mv src_folder target_folder/

Solution 4

If it’s hard to use pure shell commands, then you can install Midnight Commander, console application that makes it easier:

$ sudo apt-get install mc

Moving folder and subfolder to another path

In Midnight Commander to move folder or file from one panel to another is F6, copy F5.

$ mc

If you need root access

$ sudo mc

If you want to have a mouse support

$ sudo apt-get install gpm

Solution 5

If you want to empty fromflderpath without renaming it, stand in the folder and use

mv * ../tofolderpath/

Solution 6

sudo mv source_folder/* target_folder/

and if you have like:

source_folder/file.ext
source_folder/bin/image.jpg
source_folder/etra/info.text

all of them will be moved under target_folder like:

target_folder/file.ext
target_folder/bin/image.jpg
target_folder/etra/info.text

Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply