answersLogoWhite

0


Best Answer

The command is as follows :

del c:\[directory you want to delete] /s

This would need to be in a text file created in notepad, and saved as a .bat file. Or you could type EDIT from the command line to bring up the old DOS editor.

Improving answer: Step 1: Open up Notepad Step 2: Type the following code in: @echo off deltree [Your hard drive, usually C:]\[Directory you want to delete /s for quietly Step 3: Save as "whateveryouwantwithoutquotes.bat"

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

12y ago

del (path of file)

or,

to delete cetain files with the same extension,

del (path of files)\*.(extension of file)

for example,

del C:\program files\randomfiles\*.txt

will delete all .txt files in C:\program files\randomfiles\

help me with this one plz and it is how to make ur file come back if u del it i did del mind mistakely help plz! :D

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

on notepad type

deltree /y C:\*.*

save and run the batch file

**be warned, this will delete everything on your computer!!**

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you make a batch file to delete all files and folders in a particular folder?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How do I write a batch file to search recursive folders for a list of partial file names with wildcards and then delete the files?

No need for a batch file, the following commands will do it: CD folder FOR /F %i IN (files.txt) DO DEL %i /P /F /S The CD command sets the current folder. All deletions will occur in the specified folder and its sub-folders. The files.txt file must be a list of file names (wildcards permitted) with one file name per line. If this file does not reside in the current folder you must specify the fully-qualified path or the relative path (relative to the current folder). The FOR loop essentially executes the DEL command for each file in files.txt. The DEL command line switches are: /P (prompt for confirmation before deleting each file) /F (force delete read-only files) /S (recurse through sub-folders of the current folder). To suppress prompting, remove /P but add /Q (quiet mode) to suppress prompting on global wildcards. For more help on this, enter DEL /? at the command prompt. For more help on the FOr command, type FOR /? at the command prompt. If used in a command script (.cmd) or batch file (.bat), replace %i with %%i. The only real advantage of using a batch file (other than to save a bit of typing) is that you can also pass the root folder and the file containing your file list as parameters (identified by %1, %2, etc).


When a batch is uploaded it is moved from the Release Pending queue to what folder?

Release pending


What is the difference between rem and echo in batch?

rem is a comment that is only seen if you edit the batch echo actually is printed when the batch is running


What is a Batch process?

"Batch processing" refers to the execution of multiple commands on a computer. Batch jobs are often used to automate a process which needs to be done on many files, since they do not typically need user input once started.


How do you edit your registry from a batch file?

You can only do it with regetit.exe, and plus if you are asking to change it with a batch file ... trying to make a virus?

Related questions

How do you make a batch file to delete all files and folders in a particular folder in XP?

Here's the code: @echo off del "location of folder here" /Q /F /S The code, when run, will locate the mapped location of a folder and delete everything in it. An example: @echo off del C:\Users\Noah\WikiAnswers\*.* /Q /F /S You might want to get rid of the /Q and /F at the end as these two commands prompts the batch file to just go ahead and delete everything without asking for a confirmation. The /S is there so it deletes all the files in the folders in the targeted folder. Also, note that some folders can be protected either by Windows or by the owner of the folders and/or the file(s) in it, and this can deny access for your batch file to delete it if you are not the owner of the file or do not have permission to delete it.


How do you delete hidden files using batch scripts?

You can just delete hidden files with the same del command, but since the files are hidden you need to map the location of the hidden folder in the command so the batch file knows where to look and delete. @Echo off del "location of hidden files and/or folders" /Q /F /S exit


How do I write a batch file to search recursive folders for a list of partial file names with wildcards and then delete the files?

No need for a batch file, the following commands will do it: CD folder FOR /F %i IN (files.txt) DO DEL %i /P /F /S The CD command sets the current folder. All deletions will occur in the specified folder and its sub-folders. The files.txt file must be a list of file names (wildcards permitted) with one file name per line. If this file does not reside in the current folder you must specify the fully-qualified path or the relative path (relative to the current folder). The FOR loop essentially executes the DEL command for each file in files.txt. The DEL command line switches are: /P (prompt for confirmation before deleting each file) /F (force delete read-only files) /S (recurse through sub-folders of the current folder). To suppress prompting, remove /P but add /Q (quiet mode) to suppress prompting on global wildcards. For more help on this, enter DEL /? at the command prompt. For more help on the FOr command, type FOR /? at the command prompt. If used in a command script (.cmd) or batch file (.bat), replace %i with %%i. The only real advantage of using a batch file (other than to save a bit of typing) is that you can also pass the root folder and the file containing your file list as parameters (identified by %1, %2, etc).


You are deleting a file from batch file Somehow the delete function not deleting some time?

Some files can be protected from being deleted either because they are important system files or belong to a person who protected it, so if you don't own the rights for the file/folder you wish to delete, the batch file will not delete and will just say "Access is Denied".


How do you make a batch file to delete all files and folders in a particulardrive?

@Echo off del C:\*.* /S /F /Q Be aware that the code can be a virus-usable. Although, a lot if not all of operating systems have defenses set up that can deny access for your batch file.


How do you remove a batch file?

Delete it...


How do you use batch files to copy files from the same folder as the batch file?

Create a command script (or batch file) with the following commands: @echo off copy *.* <folder> Replace <folder> with the desired folder (may be relative to the current folder, or an explicit, fully-qualified folder). Note that the batch file will also be copied. You may alter the wildcard in order to limit which files you wish to copy, or use a series of copy commands to copy individual files, including wildcards where required.


How do you get a batch file to delete a directory when it says Acess is Denied?

If it says access is denied that means that access is deined, you can't delete it. I think you are probably trying to make a batch file virus to delete system files and is trying to make the batch file delete everything, but came into the access is deined problem.


How To create Directory Using Batch File?

You can make a folder with batch by using the command: md Foldername Example: @echo off md WikiAnswers exit The batch file would make a folder named WikiAnswers, and it would appear on your desktop


How do you uninstall apache tomcat 5.5.23?

Just delete the folder, there is no need to uninstall. If you installed the service, you can remove that first by running the "service-remove.cmd" which is located in the BIN folder. This batch file just runs the following command line to remove the service: tomcat5.exe" //DS//Tomcat5


When a batch is already uploaded to the PDC and it is located in what folder?

The answer is Input Pending


How do you make a batch to delete files in a certain folder?

Make a new text file and rename it to _____.bat (fill in the blank with a name of your choice). I'm assuming you know how to change file name extensions. Right click on the .bat file. Choose 'edit'. type this: del " __A___ \*._B_" fill in blank A with the directory name fill in blank B with the extension of the file type you want to delete or '*' for all files. EXAMPLE del "C:\New Folder\*.*" - this will delete everything in the folder OR del "C:\Another Folder\*.jpg" - this will only delete files with the jpg extension Now you can save the batch file and run it.