linux - How to get all the files whose names contain certain pattern in the immediate subdirectory of the current directory without using find? -
i try
ls */ | grep "\.txt$"
to find .txt file in subdirectory seems can't work time.
the pattern want can matched single glob:
ls */*.txt
the ls
isn't necessary; demonstrates works. can use
echo */*.txt printf '%s\n' */*.txt files=( */*.txt ) f in */*.txt; ....
the pattern (*/*.txt
) expand list of matching files; can do list broad.
Comments
Post a Comment