I have a directory called uploads
. It contains a bunch of files, plus a few subdirectories which in turn contain files.
Is there a way I can (in one step) do the following:
-
List ONLY the files in the root uploads directory — I do not want to see the subfolder names or their contents;
and
-
Do NOT list any files that start with
t_
I know about the -d
flag, but it doesn't get me quite what I want.
Best Answer
This sounds like a job for
find
.-maxdepth
to only return the current directory, not recursivly search inside subfolders-type f
to only return files and not directories or device nodes or whatever else-not
and-name
to avoid the files with names you don't wantIt might come together like this: