forfiles delete files with contain words syntax

Elad 1 Reputation point
2020-12-28T16:35:05.323+00:00

Hi ,

Im using forfiles for some years now .

i always use the *.something to delete those file im searching.

can i delete file contains some word common to all in the script.

like i have multiple file contains 12345_add_somthing.txt

i looking to search only the word "add" or "add" in all sub folders.

is it possible?

this is my current script

forfiles /p "H:" /s /m *.mp4 /d -21 /c "cmd /c del @mutia keyza &echo @mutia keyza >> C:\FORFILES_LOG\record.txt"

Thanks

Windows for business | Windows Server | User experience | Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2020-12-29T09:34:40.37+00:00

    Hi,

    Of cource you can use the searchmask *_add_*

    forfiles /p "H:" /s /m *_add_*.mp4 /d -21 /c "cmd /c del @path&echo @path >> C:\FORFILES_LOG\record.txt"  
    

    Best Regards,
    Ian Xue

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Elad 1 Reputation point
    2021-01-04T22:19:25.427+00:00

    THX!
    Most appreciated...

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.