how to loop all files and delete in folder with batch script?

Viewed 24

My folder structure

TOOL(Its contains lot of sub folders)
    >folder 1
        >> __pycahe__(its contains pyc file)
            >>> test.pyc
    >folder 2
        >> __pycahe__(its contains pyc file)
            >>> test2.pyc
    >folder 3
        >> __pycahe__(its contains pyc file)
            >>> test3.pyc

i need delete all pyc file here my script

rem my bat file is in tool folder
for /r %%f in (*.pyc) do ( 
 echo %%f rem output:D:/TOOL/folder 1/__pycahe__/test.pyc
 del %%f rem output: system can not find the specified path
)

but if try del commend like this del folder 1/__pycahe__/%%~nxf its working but is kind hardcode

how delete files in for loop.

0 Answers
Related