Solved Moving File to other folder

September 6, 2012 at 02:32:49
Specs: Windows XP
Hi, Need advice... I need help a MS DOS Script to read content of file...I have a folder contain a new file every hour. if the file contain "RJ45" then the script should move the file to folder c:\Network.
Please help.
Thanks in advance.

See More: Moving File to other folder

Report •

#1
September 6, 2012 at 02:47:44
:: ===== script starts here ===============
::
:: alex.bat 2012-09-06 16:39:50.67
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
find "RJ45" < %%a > nul
if !errorlevel! equ 0 echo move %%a c:\Network
)
goto :eof
::====== script ends here =================


====================================
Life is too important to be taken seriously.

M2


Report •

#2
September 6, 2012 at 03:53:28
Hi M2,
A big thanks for your quick reply...
I have ran the script.. but nothing moved...
then I remove the "echo"... to be
if !errorlevel! equ 0 move %%a c:\Network
)
then the file contain "RJ45" move to c:\Network... unluckily, the script file also move to c:\Network..
Do you have any idea to keep the script file stay on the original folder?
Thanks


Report •

#3
September 6, 2012 at 05:00:49
✔ Best Answer
:: ===== script starts here ===============
::
:: alex.bat 2012-09-06 16:39:50.67
@echo off & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b/a-d') do (
find "RJ45" < %%a > nul
if !errorlevel! equ 0 if /i "%%a" neq "alex.bat" echo move %%a c:\Network
)
goto :eof
::====== script ends here =================


====================================
Life is too important to be taken seriously.

M2


Report •

Related Solutions

#4
September 6, 2012 at 05:20:19
Hi M2,
It works. Super!!!

Many thanks for your help


Report •

Ask Question