'Distinguish a file and a folder in linux

in linux command I want to move all files with 's' to a folder 'test1' with the following command

mv *s* test1/

It worked but at the end, an error was shown 'it is not possible to move the folder to itself'.

I'm curious, how can I specify, only move file with 's', not folder.



Solution 1:[1]

find . -maxdepth 1 -type f -name "*s*" | xargs mv -t ./test1 this command will only copy files that start with the letter s and ignore folders.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Mkhgkk Lmnx