Jump to content

Script to find folders


Recommended Posts

Many years ago I decided to rip my entire CD collection to my hard drive. I've bounced between Windows Media Player, iTunes and Amarok on Linux, each who've tagged songs differently, and tried to rearrange music according to those varying tags. I want to try and cleanup my D:\Music folder.

I'm wondering if someone could whip together a simple script (VB or Powershell, since I'm running Windows 7 Ultimate, which should have Powershell) that can scan subfolders and report which folders don't have any music files in them. All my music is either in .mp3, .m4p or .m4a format.

Thanks!

Link to comment
Share on other sites


Wouldn't it be easier to install the trial version of TreeView Pro.

Use the "Extensions" tab to filter for mp3's or whatever.

Wouldn't that show me folders that do have mp3's in them?

I'm trying to find folders without music, so I can delete those folders. Various programs have retagged and moved music files, leaving folders behind that are either empty, or just have an album artwork jpg. I was hoping to clean those up.

I should also note that the free utility WinDirStat seems to do the same job as TreeView for free.

http://windirstat.info/

Edited by enderandrew
Link to comment
Share on other sites

Folders that have zero MP3's will show up with zero filesize when MP3 filter is on. But you might not even need to do all that.

This tool shows you the folder size, just grab all the folders under 1MB (likely only JPEGs) and move them to a temp folder.

Rescan the temp folder and make sure no MP3 or other audio files remain before deletion.

EDIT: Shouldn't matter whose program you use, probably quite a few can do the trick, never saw the free-ware one before. Thanks.

Edited by MrJinje
Link to comment
Share on other sites

If you want a nice simple VBS script that will list all you music files on your computer

Save As ListMusicType.vbs

 Option Explicit 
Const ChSize = 1572864
Const MB = 1048576
'-> Objects To Work With
Dim Act :Set Act = CreateObject("Wscript.Shell")
Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Wmi :Set Wmi = GetObject("winmgmts:\\.\root\cimv2")
'-> Wmi Querry For Extensions
Dim Col :Set Col = Wmi.ExecQuery("Select * from CIM_Datafile " & _
"Where Extension = 'mp3' " & _
"OR Extension = 'wma' " & _
"OR Extension = 'm4p' " & _
"OR Extension = 'm4a'")
'->Text File For Outpit
Dim Text :Text = Act.SpecialFolders("Desktop") & "\MusicSearchList.txt"
'-> Varibles To Be Used By The Script
Dim File, Obj, Ts
'-> Start Text File
Set Ts = Fso.CreateTextFile(Text)
Ts.WriteLine "Time : " & Time
Ts.WriteLine "Date : " & Date
Ts.WriteLine "-----------------------------------------------------------------------------"
'-> Loop Threw All Folders On Local Hard Drive
For Each Obj in Col
'-> Used This For Output Purpose
Set File = Fso.GetFile(Obj.Name)
'-> Lets Check To Make Sure It Bigger Then 1,5 MB
If Not File.Size > ChSize Then
Else
Ts.WriteLine "Name : " & File.Path
Ts.WriteLine "Size : " & FormatNumber(File.Size / MB,2)
Ts.WriteLine "-----------------------------------------------------------------------------"
End If
Next
'-> Close Text File
Ts.Close
'-> Run Text File
Act.Run("Notepad " & Chr(34) & Text & Chr(34)),1,True

Link to comment
Share on other sites

RmEmpty v1.2 by Douglas Good

Freeware

This program searches folders given on the command line for empty directories, and

removes them. Directories containing files are not removed, and no files are deleted.

The search is always recursive. Multiple folders can be specified on the command line.

RmEmpty v1.2

I place a shortcut to rmempty on my sendto folder.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...