|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Delete the contents of a directory using Batch Hello, I am looking for the the dos command that can run in BATCH files in order to remove the entire contents of a directory (files + subdirectories) But this should delete the content only without deleting the directory in question because it is shared(temp, cookies, history). The command rmdir or rd does not solve my problem , please help me thanks in advance |
#2
| |||
| |||
Re: Delete the contents of a directory using Batch Personally, I use the batch file with the code below: Code: @ echo off echo Deleting Internet Explorer Cache del "%USERPROFILE%\Local Settings\Temporary Internet Files\*.*" /s /q echo Deleting History Internet Explorer del "%USERPROFILE%\Local Settings\History\*.* /s /q echo Deleting cookies in Internet Explorer del "%USERPROFILE%\ Cookies \ *.*" /s /q /f echo Deleting Data Application del "%USERPROFILE% Application Data \ *.*" /s /q /f echo Deleting files new opened del "%USERPROFILE%\ Recent \ *.*" /s /q /f echo Deleting files java del "%USERPROFILE%\.java \*.*" /s /q /f echo Deleting files java web start del "%USERPROFILE%\.javaws\*.*" /s /q /f echo Deleting files jpi_cache? del "%USERPROFILE%\.jpi_cache\*.*" /s /q /f echo Deleting the temporary directory del %TEMP% /s /q /f breaks |
#3
| |||
| |||
Re: Delete the contents of a directory using Batch The following batch deletes both subdirectories and files in D:\ASUP: Code: Code: Select all for /f "tokens=*" %%i in ('dir D:\ASUP\*.* /AD /B') do (RD "D:\ASUP\%%i" /S /Q) echo o | del D:\ASUP\*.* Be careful while using it |
#4
| |||
| |||
Re: Delete the contents of a directory using Batch Code: CD "path\to\cookies" DEL *.* CD\ |
![]() |
|
Tags: batch, contents, directory |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I delete folders without it's contents | venkat=raghavan | Windows Software | 3 | 18-10-2010 02:15 PM |
Batch script to delete directory | Logan 2 | Software Development | 4 | 01-04-2010 12:31 PM |
Batch file to check directory | Trini Alvarado | Software Development | 5 | 01-04-2010 11:00 AM |
Virtual Directory does not allow contents to be listed | Sachit | Networking & Security | 3 | 11-07-2009 09:54 AM |
Show directory contents in C | Janet J | Software Development | 2 | 05-02-2009 11:43 PM |