New
#1
Task Scheduling With Batch File Question
Hi everyone,
I've recently been setting up some automation via TS with great success, until now.
I want it to delete daily all content, sub folders and files etc from my TV shows parent folder.
I am using the following shell script (.cmd batch file)
@echo off
setlocal enableextensions
if {%1}=={} goto :HELP
if {%1}=={/?} goto :HELP
goto :START
:HELP
echo Usage: %~n0 directory-name
echo.
echo Empties the contents of the specified directory,
echo WITHOUT CONFIRMATION. USE EXTREME CAUTION!
goto ONE
:START
pushd %1 || goto ONE
rd /q /s . 2> NUL
popd
ONE
endlocal
from this link Create Batch file to delete files and subfolders, but not root folder
I have it set up thus "C:\Scripts\CleanDir.cmd" \\Users\Administrator\Downloads\Deluge Completed in TS, and it has set everything after the commas as the argument.
It runs, it provides the result (0x1 the same as other tasks that do work), but nothing is deleted.
Can any more experienced user tell me what i'm doing wrong please? I'm guessing it's a comma or gap thing, something simple!