Pages

Tuesday, August 2, 2011

Batch File - Bulk File Remover

Have you ever faced a problem, where you need delete a particular type of files from your directory. Well I faced that while creating a zip file of a directory. The directory was downloaded from Visual Source Safe (VSS), and people who had worked with it knows that it puts an extra file that is named vssver.scc in each and every folders and sub-folders of the directory. As it was really cumbersome method to open and delete each and every folders. So I've developed a batch file for doing this.

Code:

attrib /s -r *.scc
del /s *.scc

Steps to create the batch file:
  1. Create a file with filename: del_scc.bat
  2. Open it in notepad.
  3. Copy and paste the above code in it.
  4. Save the file.
  5. Move the file to the required location, i.e., the directory from which you want to remove .scc files.
  6. Run the file by double-clicking on it.
Understand the code:
  • The first line will change the property of all the files whose extension is .scc by converting it from read-only to writable file.
  • The second line will delete all the files whose extension is .scc from the current folder and their sub-folders.
Scope of this code:
The code can be extended to include any type of files. I'd recently used to delete .fla files from the scorm course package directory.

No comments:

Post a Comment