Created
December 22, 2022 13:20
-
-
Save tcpdump-examples/693ed4352999c3ba13e38c0728c482a4 to your computer and use it in GitHub Desktop.
Revisions
-
tcpdump-examples created this gist
Dec 22, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,10 @@ find command:https://www.howtouselinux.com/post/find-file-by-name-in-linux # Use find command, find all *.txt files but ignore foo.txt find . -type f \( -iname "*.txt" ! -iname "foo.txt" \) # To delete file add -delete or -exec your-delete-command-here option. find . -type f \( -iname "*.txt" ! -iname "foo.txt" \) -delete # To select folder or dirs use -type d, in this example, find all folders and ignore foo and bar folder : find . -type d \( ! -iname "foo" ! -iname "bar" \) # To delete folders except foo and bar find . -type d \( ! -iname "foo" ! -iname "bar" \) -execdir rm -rfv {} + # Be careful while deleting files and dirs.