PC Review


Reply
Thread Tools Rate Thread

Batch File Rename + Date added & Move to another location

 
 
carla_cund@hotmail.com
Guest
Posts: n/a
 
      17th Jan 2007
Hi

I hope someone can help. I have searched around all the posts but to
be honest i cant quite find what im lookng for exactly.

I need to run a batch file which will go to this location
c:\perflogs\networksops2.csv and move this file to a level down
c:\perflogs\archivedperflogs and rename the file keeping the original
name but adding a date to it ie networkops220070117.csv

This needs to be run every week on a schedule. The original location
every week will have the c:\perflogs\networksops2.csv file added by a
performance log. I need to then archive this data off so it is not
overwritten every week

Can anyone please help, I am new to batch file writing. This is what i
have so far. Not much i know

move c:\perflogs\networksops2.csv
c:\perflogs\archivedperflogs\networksops2.csv

hope someone can help me

thanks alot

Carla

 
Reply With Quote
 
 
 
 
foxidrive
Guest
Posts: n/a
 
      17th Jan 2007
On 17 Jan 2007 03:32:59 -0800, (E-Mail Removed) wrote:

>I need to run a batch file which will go to this location
>c:\perflogs\networksops2.csv and move this file to a level down
>c:\perflogs\archivedperflogs and rename the file keeping the original
>name but adding a date to it ie networkops220070117.csv
>
>This needs to be run every week on a schedule. The original location
>every week will have the c:\perflogs\networksops2.csv file added by a
>performance log. I need to then archive this data off so it is not
>overwritten every week


Try this: (untested)

@echo off
:: Code by Herbert Kleebauer
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(L...RX2Dx=>d_t.com
echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY Wv;ovBX2Gv0ExGIuht6>>d_t.com
echo LisqMz`wGH@wKuur`G@w?ogBgGG}G?j_egoNOG?w?`gBLksqgG`w?WgBgG>>d_t.com
echo G}G?R_MgoNMy?wSx@W?s?W?@zAB`LrFuBLyt~vuco{@LuKooD?BFHqrIcP>>d_t.com
echo _sdDxb1T??=?rILO_sdDqx1T??=?rILO_sdDnl1T??=?rILO_sdD`c1T??>>d_t.com
echo =?rILO_sdDgg1T??=?rILO_sdDll1T??=?rILO_sdDrr1T??=??IL?0xxx>>d_t.com

d_t.com>d_t.bat
call d_t.bat
del d_t.com
del d_t.bat

echo century: %_cy%
echo year: %_yr%
echo month: %_mo%
echo day: %_da%
echo hour: %_hh%
echo minute: %_mm%
echo second: %_ss%

move c:\perflogs\networksops2.csv
c:\perflogs\archivedperflogs\networksops2%_cy%%_yr%%_mo%%_da%.csv


 
Reply With Quote
 
carla_cund@hotmail.com
Guest
Posts: n/a
 
      17th Jan 2007
Hi

Thanks for your help. However I have put this into a file and saved as
a .bat file and get errors within in (added the pause function so i
could see what was happening)

errors :

C:\Documents and Settings\Carla.Cund\Desktop>move
c:\perflogs\networksops2.csv

The system cannot find the file specified.

C:\Documents and
Settings\Carla.Cund\Desktop>c:\perflogs\archivedperflogs\networ
ksops2.csv
'c:\perflogs\archivedperflogs\networksops2.csv' is not recognized as an
internal
or external command,
operable program or batch file.

Does this mean anyhting to you?

Thanks Again for all your help

carla

 
Reply With Quote
 
foxidrive
Guest
Posts: n/a
 
      18th Jan 2007
On 17 Jan 2007 07:45:58 -0800, (E-Mail Removed) wrote:

>Hi
>
>Thanks for your help. However I have put this into a file and saved as
>a .bat file and get errors within in (added the pause function so i
>could see what was happening)
>
>errors :
>
>C:\Documents and Settings\Carla.Cund\Desktop>move
>c:\perflogs\networksops2.csv
>
>The system cannot find the file specified.
>
>C:\Documents and
>Settings\Carla.Cund\Desktop>c:\perflogs\archivedperflogs\networ
>ksops2.csv
>'c:\perflogs\archivedperflogs\networksops2.csv' is not recognized as an
>internal
> or external command,
>operable program or batch file.
>
>Does this mean anyhting to you?


The following is on one line separated by a space, in the batch file - it
seems you have it on two lines.

move c:\perflogs\networksops2.csv
c:\perflogs\archivedperflogs\networksops2%_cy%%_yr%%_mo%%_da%.csv


>Thanks Again for all your help


You're welcome.
 
Reply With Quote
 
carla_cund@hotmail.com
Guest
Posts: n/a
 
      18th Jan 2007
Hi again

i had a closer look at the move code and it appears that the file was
mis spelt so that is the reason it couldnt find the specified file!

Now then. It has moved the file. But not added the date into the
filename here is what it has run through-no errors, successfully moved
file but not renamed:

C:\Documents and Settings\Carla.Cund\Desktop>d_t.com 1>d_t.bat
'd_t.com' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\Carla.Cund\Desktop>call d_t.bat

C:\Documents and Settings\Carla.Cund\Desktop>del d_t.com
Could Not Find C:\Documents and Settings\Carla.Cund\Desktop\d_t.com

C:\Documents and Settings\Carla.Cund\Desktop>del d_t.bat

C:\Documents and Settings\Carla.Cund\Desktop>echo century:
century:

C:\Documents and Settings\Carla.Cund\Desktop>echo year:
year:

C:\Documents and Settings\Carla.Cund\Desktop>echo month:
month:

C:\Documents and Settings\Carla.Cund\Desktop>echo day:
day:

C:\Documents and Settings\Carla.Cund\Desktop>echo hour:
hour:

C:\Documents and Settings\Carla.Cund\Desktop>echo minute:
minute:

C:\Documents and Settings\Carla.Cund\Desktop>echo second:
second:

C:\Documents and Settings\Carla.Cund\Desktop>move
c:\perflogs\networkops2.csv c:
\perflogs\archivedperflogs\networksops2.csv
The system cannot find the file specified.

C:\Documents and Settings\Carla.Cund\Desktop>pause
Press any key to continue . . .



Hope you can help!

thanks
Carla

 
Reply With Quote
 
carla_cund@hotmail.com
Guest
Posts: n/a
 
      18th Jan 2007

Thanks for that, I have done that, and also found tha tthe actual name
of the file was wrong (ooops my fault) So the batch file moves the
file into the correct place, howeveer its not adding the date to the
filename- any ideas? Heres a copy of te script that its run


C:\Documents and Settings\Carla.Cund\Desktop>d_t.com 1>d_t.bat
'd_t.com' is not recognized as an internal or external command,
operable program or batch file.

C:\Documents and Settings\Carla.Cund\Desktop>call d_t.bat

C:\Documents and Settings\Carla.Cund\Desktop>del d_t.com
Could Not Find C:\Documents and Settings\Carla.Cund\Desktop\d_t.com

C:\Documents and Settings\Carla.Cund\Desktop>del d_t.bat

C:\Documents and Settings\Carla.Cund\Desktop>echo century:
century:

C:\Documents and Settings\Carla.Cund\Desktop>echo year:
year:

C:\Documents and Settings\Carla.Cund\Desktop>echo month:
month:

C:\Documents and Settings\Carla.Cund\Desktop>echo day:
day:

C:\Documents and Settings\Carla.Cund\Desktop>echo hour:
hour:

C:\Documents and Settings\Carla.Cund\Desktop>echo minute:
minute:

C:\Documents and Settings\Carla.Cund\Desktop>echo second:
second:

C:\Documents and Settings\Carla.Cund\Desktop>move
c:\perflogs\networkops2.csv c:
\perflogs\archivedperflogs\networkops2.csv

C:\Documents and Settings\Carla.Cund\Desktop>pause
Press any key to continue . . .

thanks

carla

 
Reply With Quote
 
foxidrive
Guest
Posts: n/a
 
      18th Jan 2007
On 18 Jan 2007 01:48:33 -0800, (E-Mail Removed) wrote:

>
>Thanks for that, I have done that, and also found tha tthe actual name
>of the file was wrong (ooops my fault) So the batch file moves the
>file into the correct place, howeveer its not adding the date to the
>filename- any ideas? Heres a copy of te script that its run
>



>C:\Documents and Settings\Carla.Cund\Desktop>d_t.com 1>d_t.bat
>'d_t.com' is not recognized as an internal or external command,
>operable program or batch file.


This line shows that the top portion of the batch file where it looks like
an ascii jumble, is missing or corrupted.

Copy and paste the code from the message again.

 
Reply With Quote
 
carla_cund@hotmail.com
Guest
Posts: n/a
 
      18th Jan 2007
I fi cope all of the message again and insert it, I recieve a 16 bit
ms-dos subsystem error. It states

The NTVDM CPU has encountered an illegal instruction. Choose close to
terminate the application.


If i select ignore it still copies the file from the directory to the
other directory but still doesnt rename it. Any ideas?

 
Reply With Quote
 
foxidrive
Guest
Posts: n/a
 
      18th Jan 2007
On 18 Jan 2007 03:06:13 -0800, (E-Mail Removed) wrote:

>I fi cope all of the message again and insert it, I recieve a 16 bit
>ms-dos subsystem error. It states
>
>The NTVDM CPU has encountered an illegal instruction. Choose close to
>terminate the application.
>
>
> If i select ignore it still copies the file from the directory to the
>other directory but still doesnt rename it. Any ideas?


It's hard to say - did you paste the message into Notepad and save it?

 
Reply With Quote
 
carla_cund@hotmail.com
Guest
Posts: n/a
 
      18th Jan 2007
hi

Yes i have copied all this into a notepad and saved as batch.bat ,
double clicked and the error appears. I am running Windows XP, will
this be a factor?

@echo off
:: Code by Herbert Kleebauer
echo Bj@jzh`0X-`/PPPPPPa(DE(DM(DO(Dh(Ls(L...RX2Dx=>d_t.com

echo 0DxFP,0Xx.t0P,=XtGsB4o@$?PIyU WwX0GwUY
Wv;ovBX2Gv0ExGIuht6>>d_t.com
echo
LisqMz`wGH@wKuur`G@w?ogBgGG}G?j_egoNOG?w?`gBLksqgG`w?WgBgG>>d_t.com
echo
G}G?R_MgoNMy?wSx@W?s?W?@zAB`LrFuBLyt~vuco{@LuKooD?BFHqrIcP>>d_t.com
echo
_sdDxb1T??=?rILO_sdDqx1T??=?rILO_sdDnl1T??=?rILO_sdD`c1T??>>d_t.com
echo
=?rILO_sdDgg1T??=?rILO_sdDll1T??=?rILO_sdDrr1T??=??IL?0xxx>>d_t.com


d_t.com>d_t.bat
call d_t.bat
del d_t.com
del d_t.bat


echo century: %_cy%
echo year: %_yr%
echo month: %_mo%
echo day: %_da%
echo hour: %_hh%
echo minute: %_mm%
echo second: %_ss%


move c:\perflogs\networksops2.csv
c:\perflogs\archivedperflogs\networksops2%_cy%%_yr%%_mo%%_da%.csv

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Rename file with added date SandySun Microsoft Access 2 25th Aug 2008 10:28 PM
Batch file to rename with time and date alexanderd79@googlemail.com Windows XP General 1 23rd Nov 2007 12:57 PM
Batch File Rename richk Freeware 3 4th Dec 2005 11:27 AM
Re: rename file in batch with date in file name guard Microsoft Windows 2000 CMD Promt 0 16th Sep 2003 11:01 PM
Re: rename file in batch with date in file name guard Microsoft Windows 2000 New Users 0 16th Sep 2003 11:01 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:18 PM.