Batch File to Move and Rename?

May 13, 2015 at 02:35:50
Specs: Windows 7

I do not have much knowledge of batch files but i have tried looking over the internet and wrote a few simples ones however everything i view appears to be a little too complex for me to understand and does not break down how to interpret each part of the batch file to work as i require.

What i need, i use a program at work on a daily basis which allows me to calibrate a piece of equipment prior to use. This program records all the information into a log file found within the user directory on my C drive. This log file is updated to include the latest calibration every time i close the software.

I want to create a batch file that copies the log file from its original source location to a new directory and renames said file to show the date.

The idea is once i have calibrated the machine i can then run this batch file to move the newly updated log file into a new directory under the days date, this way i can open the log file for a given date and instantly see the latest piece of information and not have to scroll up through pages of information to locate a given date.

I managed to figure out how to move the file using

@echo off
XCOPY C:\(source directory) C:(destination directory)

However following some instructions and other peoples input i am struggling to get the file to rename to the date.

Any help is greatly appreciated

I have also tried viewing a couple of posts on this forum including, (P.s.) i hope links are okay within this forum.

Many Thanks

message edited by KrisWain

See More: Batch File to Move and Rename?

Report •

May 13, 2015 at 19:13:14

Post the output of this script.

::====== script starts here ===============
:: KrisDate.bat 2015-05-14 8:26:00.99
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN

for /f "tokens=* delims= " %%a in ('dir/b NEWFILE') do (
goto :eof
::====== script ends here =================


M2 Get custom script or take private lessons

Report •

May 14, 2015 at 22:16:58
Why not just use "FIND" using the target date value, applied to the logfile? As M2 implied, the date value must be in a format consistant with the data.

Report •

Related Solutions

Ask Question