user1425910
user1425910

Reputation: 1

find files in a directory but do not search in sub directroies

i have some issue having a directory LOG. in that so many files and directories are there. i want to find and delete the file which starts with PS. but it should not check sub directories.

Upvotes: 0

Views: 1841

Answers (1)

Prince John Wesley
Prince John Wesley

Reputation: 63708

Use find tool with maxdepth option:

find LOG-PATH -maxdepth 1 -regextype "posix-egrep" -regex '.*/PS.*' -type f -exec rm {} \;

Upvotes: 4

Related Questions