Ubuntu: Move files from one folder to another with same name


I'm new to linux, especially for ubuntu server and it's terminal.... I have such file structure:

-im   |   |-t1     |-1.jpg   |-t2     |-2.jpg    |-second     |-t1       |-3.jpg     |-t2       |-4.jpg   

How can i move from second files to main folder, so that t1 contain 1,3.jpg and t2 contain 2,4.jpg...? so that nothing in t1 and t2 to delete, but second subfolder is moved here....

Will be all ok with mv command?


Yes, you will be OK with mv, eg:

mv /path_to_source_folder/filename /path_to_destination_folder/

or, for example from the level of im/second: (cd im/second)

mv t1/3.jpg ../t1/ && mv t2/4.jpg ../t2/

There are more ways to do that, do man find for example, man rsync

when you look at ls command output, the .. (2 dots) 'means one step back', . (one dot) means 'in here' and you can use it as such

Of course if you want to remove the second folder, you use rmdir command or rm -R (use with care, always do man {command} if you are not sure.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »