Page 1 of 1

Nifty batch script to purge unnecessary files and folders...

Posted: 25 Jun 2014 13:16
by Noisia
Hi!

I'm managing to create a script to purge unnecessary files from my music folders. I've managed to make it work when embedded in respective folder but i aim to create a exe file and run it from right-click menu.
I reckon this script is flawed and it only works well in *.bat format. As soon as i convert to exe it only works partially.

The code follows:

Code: Select all

for %%g in (*.jpg,*.jpeg,*.m3u,*.m3u8,*.cue,*.sfv) do if not %%g == folder.jpg recycle %%g

for /d /r . %%d in (scans,covers,video,technical) do @if exist "%%d" recycle "%%d"


I need to complete it but i lack the knowledge. Is anybody willing to help me please? :)

Thank you in advance!

Re: Nifty batch script to purge unnecessary files and folder

Posted: 26 Jun 2014 00:52
by foxidrive
What is the recycle command?

You need to explain what you are trying to do.

Re: Nifty batch script to purge unnecessary files and folder

Posted: 26 Jun 2014 06:06
by Noisia
My apologies for not being succinct on that. I have "recycle.exe" located in my windows folder enabling me to use "recycle" command instead of permanently deleting files using "del" command.

What i'm trying to achieve is simple:

1- Recycle all files containing the following extensions: *.jpg,*.jpeg,*.m3u,*.m3u8,*.cue,*.sfv.
2- Recycle all folders that match the following names: scans,covers,video,technical.
3- If there is "folder.jpg" inside the directory, keep it.

I also want to convert this batch script to a EXE file and run it from the main directory to purge all sub-directories.

Let's say i have a directory called "Jimmy Hendrix" and his albums as sub-direcories. I want to be able to right click Jimmy Hendrix and purge every sub-directory by running a exe file.

Re: Nifty batch script to purge unnecessary files and folder

Posted: 26 Jun 2014 08:52
by foxidrive
This will remove those filetypes from the current folder and below.

Code: Select all

del /s *.jpg *.jpeg *.m3u *.m3u8 *.cue *.sfv