Computer Viruses
Microsoft Windows
Windows XP

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

Top Answer
User Avatar
Wiki User
Answered 2008-01-18 19:07:03

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.


del "C:\New Folder\*.*" - this will delete everything in the folder


del "C:\Another Folder\*.jpg" - this will only delete files with the jpg extension

Now you can save the batch file and run it.

User Avatar

Your Answer

Related Questions

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

Yes because if you deleted the folder what would hold the files?

Delete all the files inside the /public_html/ folder. Do not delete the folder, Delete the stuff inside it.

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.

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".

Easy...You make a folder (call it something/ or anything) put this folder in the beginning...Name it something (i.e. Deleted files)Drag all your unwanted files (this works best when you have a lot of unwanted files) to your folderOnce that process is complete, you delete the folder*The folder will be deleted, including your unwanted files that you have put in that folder.

In Dos-just write (DEL Folder Name) this command will delete all the Files inside that folder,then write (RD Folder Name) This will Remove your Folder. Remember both command contain Same folder name. Which you want to Delete.(DEL)command is used to delete Files. (RD) command is used to delete Folder

It depends on what kind of files are in the CD's folder. If it's a CD that was purchased with software in the folders, you probably cannot delete the folder as the files within it are write-protected against accidental deletion. If the CD is something you created and your account has full rights to the files within, you should be able to delete the folder. If it gives you an error that the folder cannot be deleted because it is not empty, delete the contents first, then the folder.

You can delete them just like any other folder.

In Windows, it will be rmdir or rd. In Unix-based or Unix-like systems, the command is rmdir (however, it will not delete any folders that still have subfolders or files inside - for this, you use rm -r <name of folder to delete> to delete the folder and any files or subfolders).

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.

You can run disk cleanup and also can delete files from temp folder and you should also delete the prefetch folder files after 3-4 months as if you uninstall applications the prefetch folder still is left with the unnecessary clutter. Take a look at this helpful link.

If you delete a folder then everything in it will be deleted. So if there are files in it, they will be deleted. So always be careful when deleting folders.

yes. just delete your server files, or if you just dont like the world, then delete the folder called "world" in you server folder.

RBF files are a type of backup file that are found in the Config.Msi folder on your operating system. Yes, you can delete RBF files on your computer.

Save the batch files you want to email in a folder. Right click over the folder and click "Add to archive". A window will pop-up. Just click "OK". The archived folder will be saved in the same location as the folder you put to archive. Log into your email id and compose a mail. Attach the archived folder to the email and send it. When the receiver downloads the attachment he received with the email, he will find a archived folder with the batch files you sent.

yes you can delete the system volume info folder but they are very important in waorking of OS(operating system) so i advise you not to delete it

Unless you are making a site yourself and saved the HTML files for later uploading, it is normally safe to deleate HTML files. Html files are website pages which are normally saved for later use by the internet explorer. These are normally saved in a temp folder and can be deleted. Other uses for HTML files are help files, which if deleted, you may not view the help file of the program. Therefore before deleting HTML files, check the folder from where you will delete the files. If they are from a program file, it is not recommended to delete the files, if they are from the internet temporary folder, you can either delete the files manually or you can delete them from the internet explorer by pressing on Delete Browsing History found in Tools.

The music files should still be in your "My Music" folder.

Yes. To delete a Minecraft server, stop the server (issue the "stop" command to the server), and then delete the server files (, the world folder, etc.) If you put the server into its own folder, then simply delete that entire folder to be rid of your server.

Deleting a file differs between Operating Systems. One can use the delete key on the keyboard. In GUI-based Operating Systems one can use the delete menu item, delete button, delete icon. One can also drag-and-drop or move files to the delete or trash folder. Text-based commands also exist that also delete files. Text-based commands can be added to scripts or batch files. There are also utilities that securely deletes files by overwriting them several times before deletion.

Just right click on the folder and select 'delete'.

This would all depend where the files are located. if they are in my documents or in the temp folder and you are sure they do not contain any important documents then you can go ahead and delete them. If they are in the windows folder proceed with caution

# To delete a corrupted IE cache and build a new cache

Copyright ยฉ 2021 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.