Sponsor-Board.de

Normale Version: fileremover
Du siehst gerade eine vereinfachte Darstellung unserer Inhalte. Normale Ansicht mit richtiger Formatierung.
Hallo SB,
habe aus langeweile mal eine batch Datei erstellt, welche einfach und schnell dateien eines Typs in einem Ordner löscht.
Was sagt ihr zu dem Code? Dies ist die erste batch datei die ich erstellt habe.

PHP-Code:
:: FILE REMOVER v2 BY EMPTYX ::

@echo 
off
title FILE REMOVER V 2.1 BY EMPTYX
color 0A
goto :home

:home
cls
echo             ========================
echo              
FILE REMOVER BY EMPTYX
echo             ========================
echo         [
1] .RAR    [2] .ZIP
echo         [3] .DLC    [4] .MP3
echo         [5] .MKV    [6] .ALL
echo         [7] EXIT    [8INFO    
echo.
echo 
WHICH FILES DO YOU WANT TO REMOVE?
echo.
echo.
SET choice=
SET /p choice=
    IF 
'%choice%' == '1' GOTO :rar
    
IF '%choice%' == '2' GOTO :zip    
    
IF '%choice%' == '3' GOTO :dlc
    
IF '%choice%' == '4' GOTO :mp3
    
IF '%choice%' == '5' GOTO :mkv
    
IF '%choice%' == '6' GOTO :all
    
IF '%choice%' == '7' exit 
    IF 
'%choice%' == '8' goto :info
    
echo ERROR
timeout 
/t 3
    
goto :home


:rar
    
echo You have chosen to delete all .RAR files.
    
set /P a=Are you sure? [Y/N]?
        if /
"%a%" EQu "Y" DEL *.rar
        
if /"%a%" EQu "Y" echo All files have been deleted!
        if /
"%a%" EQU "N" echo Canceled
    
goto :backtostart

:zip
    
echo You have chosen to delete all .ZIP files.
    
set /P a=Are you sure? [Y/N]?
        if /
"%a%" EQu "Y" DEL *.zip 
        
if /"%a%" EQu "Y" echo All files have been deleted!
        if /
"%a%" EQU "N" echo Canceled
    
goto :backtostart


:dlc
    
echo You have chosen to delete all .DLC files.
    
set /P a=Are you sure? [Y/N]?
        if /
"%a%" EQu "Y" DEL *.dlc 
        
if /"%a%" EQu "Y" echo All files have been deleted!
        if /
"%a%" EQU "N" echo Canceled
    
goto :backtostart


:mp3
    
echo You have chosen to delete all .MP3 files.
    
set /P a=Are you sure? [Y/N]?
        if /
"%a%" EQu "Y" DEL *.mp3 
        
if /"%a%" EQu "Y" echo All files have been deleted!
        if /
"%a%" EQU "N" echo Canceled
    
goto :backtostart


:mkv
    
echo You have chosen to delete all .MKV files.
    
set /P a=Are you sure? [Y/N]?
        if /
"%a%" EQu "Y" DEL *.mkv 
        
if /"%a%" EQu "Y" echo All files have been deleted!
        if /
"%a%" EQU "N" echo Canceled
    
goto :backtostart


:all
    msg 
You have chosen to delete ALL files.
    
set /P a=Are you sure? [Y/N]?
        if /
"%a%" EQu "Y" DEL *.* 
        if /
"%a%" EQu "Y" echo All files have been deleted!
        if /
"%a%" EQU "N" echo Canceled
    
goto :backtostart


:backtostart
echo.
echo.
    
set /P a=Back to start? [Y/N]?
        if /
"%a%" EQu "Y" goto :home
        
if /"%a%" EQU "N" exit

:
info
cls
echo Name:        File-Remover
echo Made by:     EmPtyX
echo Info:        The File Remover was created to remove files easilyfast and permanentYou can edit the code to your needs if you want.
echo 
Version:     2.1
goto :backtostart 


MFG

Nur aus Interesse: Unter welcher Lizenz steht das?
Ich sehe mir den Thema (aber insbesondere den Code) mit gemischten Gefühlen an.
Batch-Datei = Windows-Nutzung sehe ich. Soll also jeder verstehen. Usability-Anregungen hätte ich dennoch.

1. Sollte die EXIT-Möglichkeit nicht besser als letztes angewählt werden? Also '8' anstatt '7'?
2. Die Möglichkeit eigene Formatendungen mittels Eingabe anzuwählen. Und nebenbei, wer löscht mal beiläufig alle seine MP3s? (Überlegen, ob das Löschen dieser Dateien Sinn macht.) Damit könntest du auch deinen Code radikal kürzen.

Ich hoffe, das konnte helfen.

WombatWeb schrieb:
Nur aus Interesse: Unter welcher Lizenz steht das?


Es steht unter keiner Lizenz.

Referenz-URLs