Batch File to delete folders less than 3MB

Microsoft Windows 7 ultimate 64-bit
August 3, 2010 at 06:13:48
Specs: Windows 7
Hi there,

I am looking for a script to delete folders that are less than 1mb. I am trying to clear up my itunes music folder and because of itunes moving music files from their original folders, I have multiple folders with just a playlist file in them, and I would like to delete these.

I would really appreciate if someone would post the code to create a .bat file to achieve this.

Thanks in advance.

OS = Win7 Pro X64

See More: Batch File to delete folders less than 3MB

Report •

August 7, 2010 at 01:16:05
Hi Ghost29,

I had the same problem and mamnged to find some code that I modified to do the job. It needs to be pasted into a text editor and saved as something like DELETE.vbs. It can be rin run in a .bat file using the following command line:

wscript.exe DELETE.vbs

Dim objFD
Set objFD = CreateObject("Scripting.FileSystemObject")
Set objSelectedFolder = objFD.GetFolder("path to iTunes Folder")
Set colSubfolders = objSelectedFolder.SubFolders
For Each objSubfolder In colSubfolders
If objSubfolder.Size < 3000000 Then
objSubfolder.Delete True
End If

Report •

August 8, 2010 at 07:13:26
Thanks so much.

Report •

Related Solutions

Ask Question