Delete set of files using find command

Posted by Dave Jarvis on Super User See other posts from Super User or by Dave Jarvis
Published on 2012-12-17T21:15:48Z Indexed on 2012/12/17 23:05 UTC
Read the original article Hit count: 217

Filed under:
|
|
|

Background

Delete a set of files, scattered across different directories.

Problem

The following code does not work (the unescaped | causes issues);

for %i in (dir /s/b | find "lock") do echo del %i

Question

Without writing a batch file, how would you delete all files named "lock" (i.e., found using the find command) within the current directory and all subdirectories (including hidden directories)?

Thank you!

© Super User or respective owner

Related posts about Windows

Related posts about command-line