So for example i have one folder called "test". Inside that folder, i created one another folder called "player" and a lot of text file, let's say 50 files.

[root@ip-10-0-7-70 test]# ls
kaka.txt  player  rooney.txt

Now i want to move all of that text file into "player" folder. What's the best way to do this?

I tried

cp -r ls | ^egrep 'player'

but it didn't work.


From the test directory, do:

mv -t player *.txt

Assuming all text files end in .txt.

This will mv all .txt files from current directory (test/) to player/ subdirectory.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.