Need a file deletion script please..!

D3DAiM

Limp Gawd
Joined
Sep 30, 2006
Messages
413

1. Recursively search down from root directory "\" (these are Windows directories, so I should be able to specify directory in an argument) until bottom leaf folder(s). If ANY of the folders contain a (*.mp3 *.wma *.aac *.ogg *.m4a *.wav *.midi *.flac *.mp4), skip. Else, print empty folder's directory path.


And if you get the chance..

2. Recursively search down from root directory "\" for folder and print directory path of duplicates that match the regex = "any char, 7-in-a-row". If folder is less than 7 chars long, use match on folder name length.

I would like the recursive search to be done one directory leaf at a time, as according to the file tree in the image this attached in link. Got it? I can explain in further detail.
It'd be nice if it could be written in batch, VBS, Perl, Python, or Java/Groovy. This is what I practice and I am looking forward to improving my scripting abilities based on your work!
 
Last edited:
according to the last part of #1, you only want to delete empty folders.. or rather, folders that are empty or that only have files with extensions on them.
 
I think you should attempt this on your own. Post what you've tried and what problems you are running into. I think the responses you are going to get on "I need this script... write it in these languages... " is not going to be so good unless you are offering money.

Most people here are probably willing to help someone who is trying to figure it out on their own. Maybe if you are lucky someone will post the whole script.
 
I could probably write this in about 10 minutes for you. However, I will not do it for free.

Instead, what I will do is help you write it yourself. Go ahead and do yourself a favor and make a few rough attempts in Powershell/vbscript/Perl, see where you get, and then post them here and we'll help you out from there.
 
according to the last part of #1, you only want to delete empty folders.. or rather, folders that are empty or that only have files with extensions on them.
Yes, "empty" folders meaning not containing files with said extensions.

OK guys :p I will give it a go myself first. Not trying to order anyone around..just was hoping somebody already had made something scripted for this use
 

1. Recursively search down from root directory "\" (these are Windows directories, so I should be able to specify directory in an argument) until bottom leaf folder(s). If ANY of the folders contain a (*.mp3 *.wma *.aac *.ogg *.m4a *.wav *.), skip. Else, print empty folder's directory path.

Yes, "empty" folders meaning not containing files with said extensions.

Actually, folder can have files that do not have extensions on them. Look at the very last of your requirements.
(*.mp3 *.wma *.aac *.ogg *.m4a *.wav *.)

That would seem to indicate that any folder with any file in it that has an extension on it would need to be skipped. Or did you mean to add some other audio extension there?
 
Actually, folder can have files that do not have extensions on them. Look at the very last of your requirements.

That would seem to indicate that any folder with any file in it that has an extension on it would need to be skipped. Or did you mean to add some other audio extension there?
Whoops. Yep, I forgot to include *.flac
Fixed my original post.
Basically, if the folder contains any major audio extension, I want to skip. My bad.
 
Back
Top