Hello
I program a lot and the program I use creates a lot of useless and large sized files to debug the applications and games I make.
Could you guys please make a batch file that deletes some files and folders in the underlying maps?
This has to be deleted
- "Debug" folder (and underlying files / folders)
- "Release" folder (and underlying files / folders)
- "ipch" folder (and underlying files / folders)
- All .sdf files
It has to search in all underlying folders. I'll give an example
c:/location of batch/../../../debug/
It has to work even if it's not in the same folder.
Is this possible to create that for me?
I would be really helpfull to me.
Thanks!
Batch to delete specific files & folders
Moderator: DosItHelp
-
- Posts: 79
- Joined: 13 Dec 2010 10:32
Re: Batch to delete specific files & folders
I'm no expert but, in the batch file you could use something like this possibly:
But don't take my word for it. This is also relative the directory it executes from.
Code: Select all
for /f "tokens=*" %%a in ('dir /ad /b /s ^|findstr /e /i /r "\\Debug\>"') do rd /s /q %%a
for /f "tokens=*" %%a in ('dir /ad /b /s ^|findstr /e /i /r "\\Release\>"') do rd /s /q %%a
for /f "tokens=*" %%a in ('dir /ad /b /s ^|findstr /e /i /r "\\ipch\>"') do rd /s /q %%a
for /f "tokens=*" %%a in ('dir /b /s *.sdf') do del /s /q %%a
But don't take my word for it. This is also relative the directory it executes from.
-
- Posts: 3
- Joined: 05 Dec 2011 10:24
Re: Batch to delete specific files & folders
I've tried that code, but without any success...
I've placed it in the same folder, a folder above, etc.... Same results.
The command box pops up for 0.5 seconds and I was able to read that "the system can't find ... (I missed the other half)".
Maybe that's usefull?
I've placed it in the same folder, a folder above, etc.... Same results.
The command box pops up for 0.5 seconds and I was able to read that "the system can't find ... (I missed the other half)".
Maybe that's usefull?
-
- Expert
- Posts: 442
- Joined: 01 Aug 2010 17:13
- Location: Canadian Pacific
- Contact:
Re: Batch to delete specific files & folders
Code: Select all
for /f "delims=" %%a in ('dir /ad /b /s') do (
if "%%~nxa"=="Debug" rd /s /q "%%a"
if "%%~nxa"=="Release" rd /s /q "%%a"
if "%%~nxa"=="ipch" rd /s /q "%%a"
)
del /f /s /q *.sdf >nul 2>&1
-
- Posts: 3
- Joined: 05 Dec 2011 10:24
Re: Batch to delete specific files & folders
Thanks dude, it works now (after some tests)!
Hopefully it will keep on working!
Thanks thanks thanks!
Hopefully it will keep on working!
Thanks thanks thanks!