3

Suppose there is directory with files and most of them have "ubuntu" string in common to the name of file .

i used the command

mv ubuntu1 ubuntu2 ubuntu3 ubuntu/

now i want to move all these files from this directory to other directory without moving each file differently.

1 Answer 1

11

Use the command

mv *ubuntu* destination_directory_path/

where *ubuntu* indicates that ubuntu may appear anywhere in between the file/folder name.

NOTE: This will move all files which have ubuntu in their name in the current directory and the destination folders name should not have ubuntu in it. If it is present, first rename the destination to somthing else and then try the above command.

2
  • 1
    How would someone make this case insensitive? So it would move ubuntu and Ubuntu?
    – b_dubb
    Jul 23, 2019 at 22:22
  • 1
    @b_dubb You can use the same command but use group matching like this mv *[Uu]buntu* destination_directory_path/ . It's not exactly case insensitive matching since you have to define each group yourself but if you have specific letters you want to make that will work. Dec 27, 2019 at 20:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .