Porting macOS aliases from find to fd
#1615
-
|
I'm really enjoying using I'm in the process of porting over a couple of useful alias clean="find . -maxdepth 1 -name '*.DS_Store' -o -name '*~' -o -name '.*~' -o -name '*.swo' -o -name '*.swp' -o -name '.*.swo' | xargs rm"
alias wash="find . -name '*.DS_Store' -o -name '*~' -o -name '.*~' -o -name '*.swo' -o -name '*.swp' -o -name '.*.swo' | xargs rm"When switching I would also like to ensure that the revised Could anyone please assist with porting these commands? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
$ fd '\.(DS_Store|swo|swp)$|~$' -d1 -X rmBy the way your $ find . -maxdepth 1 \( -name '*.DS_Store' -o -name ... \) -exec rm {} + |
Beta Was this translation helpful? Give feedback.
You probably want to add
fd -uto include hidden files and.gitignored files. Also note that the-d1/--max-depth=1is in effect, remove that for wash.fd's regexes are not anchored, sofd Xis just likefd '.*X'.