How to delete a file in a bat

March 31, 2009 at 04:16:26
Specs: Windows XP
Hi

I have a bat file that sorts out and move files from one directory to another, but there are some other files that I hope that can be removed as well. The rest of the files are zip, doc and exe files.

Can this be automated as well in the same batch file and how can it be done ?


See More: How to delete a file in a bat

Report •


#1
March 31, 2009 at 04:58:54
Post your bat.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

#2
March 31, 2009 at 05:08:49
Hi here is my bat file ( There are more same lines under the move statement)
@echo off

pushd C:\Test

for /f "tokens=* delims= " %%a in ('dir/b ACEA_*.pdf') do (move %%a C:\ACEA)
for /f "tokens=* delims= " %%a in ('dir/b ACEC_*.pdf') do (move %%a C:\ACEC)
for /f "tokens=* delims= " %%a in ('dir/b ACET_*.pdf') do (move %%a C:\ACET)

set file=0
for %%j in (*) do (
  set /A file+=1
  echo.  %%j
)
echo.
echo.  %file% is not moved
popd



Report •

#3
April 1, 2009 at 03:59:36
The first part can be simplified to this:

for %%i in (a c t) do move ace%%i*.pdf C:\ace%%i

I don't know what the second part is about.


=====================================
If at first you don't succeed, you're about average.

M2


Report •

Related Solutions


Ask Question