batch file text help

Jodie959

New member
Local time
4:22 PM
Messages
1
I am trying to create a task using a batch file which i can then add to my windows task manager so that i can schedule it run every 7 days.

I need the file to delet anything which is contained within the scanned documents folder. The folder is located on a network and shared by other users.

The code that i have so far is

set "folder=\\IVNKING\Shared Files\Scanned Documents"
pushd "%folder%"
for /d %%i in ('*') do rmdir "%%i" /q
popd

Does anybody know if this will delete only the contents of the scanned documents folder or if it will delete anything in other folders in the path.
 

My Computer

Computer type
PC/Desktop
OS
windows 7 32 bit o/s
Hi Jodie,

Because there are single quotes placed around that asterisk of your For loop, the For loop will find nothing to loop on. The single quotes aren't meant to be there.

Once you've fixed the For loop (by removing those single quotes), I can tell you what the batch file does: it will delete all non-hidden, empty-only folders under "\\IVNKING\Shared Files\Scanned Documents", and will not touch any files.

I need the file to delete anything which is contained within the scanned documents folder.
Below is a batch file that will do just that.
Code:
set "folder=\\IVNKING\Shared Files\Scanned Documents"
pushd "%folder%" || exit /b
del * /f /q
for /f "delims=" %%I in ('dir /a:d /b') do rd "%%~I" /s /q
popd
 

My Computer

Computer type
PC/Desktop
OS
Windows 10, Windows 8.1 Pro, Windows 7 Professional, OS X El Capitan
Back
Top