As a real world example.
If you have the following batch file in your parent directory
call "directory 1\DeleteAll.bat"
Then in subdirectory "directory 1" (the child directory) you have another batch file called DeleteAll.bat
del "%~dp0\*.txt"
The parent batch file calls the child batch file, which deletes all .txt the the child directory ("directory 1"). Bear in mind you don't want to try and delete the batch file itself (I assume) so you'll need to specify whatever masks you're looking to delete in the child batch files.
Information based on the serverfault answer Get directory containing the currently executed batch script
Note:
If no files match the specified mask (e.g. .txt) it is normal to get a Could Not Find message. The batch file will continue to run and you can ignore this message if these files may or may not exist. If you'd prefer, you can suppress the message as shown in How do I prevent the “Could Not Find” error message from del *.txt?
Alternative syntax for child batch files
If you have a lot of masks to delete and/or you wish to simplify the delete syntax, you could use the following syntax in your child batch files. Based on the information at How do I find the current directory of a batch file, and then use it for the path?
pushd "%cd%"
cd "%~dp0"
del 1.txt
del 2.mpg
del "name with spaces.mpg"
del *.tmp
popd
In that example pushd
is used to save the current directory (initially where you ran the parent batch file from). cd
is used to switch to directory containing the child batch file, then popd
restores the saved directory