Jump to content

Batch Programming Problem


Recommended Posts

I need to move xml files from folderA to folderB. Before the are moved to folderB I need to create a subfolder in B that is named according to system date and time. I have the code to move the files from folderA to folderB:

move /y C:\folderA\*.xml C:\folderB\

I have the code that creates a new folder and names it according to system time stamp of year,month,day_hours,minutes,seconds:

REM Create sub directory called \yymmdd_hhmmss

REM where yymmdd_hhmmss is a date_time stamp like 030902_134200


set hh=%time:~0,2%


REM Since there is no leading zero for times before 10 am, have to put in

REM a zero when this is run before 10 am.


if "%time:~0,1%"==" " set hh=0%hh:~1,1%

set yymmdd_hhmmss=%date:~12,2%%date:~4,2%%date:~7,2%_%hh%%time:~3,2%%time:~6,2%

md D:\batch-programming\%yymmdd_hhmmss%

how do I marry the two? I need to move the file to the newly created subfolder named from timestamp in folderB.

Link to comment
https://forums.phpfreaks.com/topic/152598-batch-programming-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.