|
Answer» Hi want to copy 3 Folders with 168 jpeg files each
C:\Firemod\temp
to
B:\Projects\Fire Behaviour Outputs\Hourly output\ddmmyyyy
where this folder has created using the following codes
** codes** ======================================================= @echo off echo D = Now : WScript.Echo Right(100+Month(D),2) _ >%temp%\today.vbs echo ^& Right(100+Day(D),2) ^& Right(Year(D),4) >>%temp%\today.vbs
for /f "tokens=1" %%a in ( 'cscript.exe //Nologo %temp%\today.vbs') do set today=%%a
del %temp%\today.vbs
echo Hi
echo saahmadbulbul, Todays date is : %today% md %today%
echo Created a folder for you; it is in B:\Projects\Fire Behaviour Outputs\Hourly output as todays date
=======================================================
each day file name will change and I need to copy those files as a regular basis.
I do not have programming skill to write complex code. Does anyone knows how to do it in winXP cmd?
Thanks a lot if you can solve this problem.
saahmadbulbul
I also was trying to create a folder with the name as the CURRENT date. I found an article on this website TITLED "How can I make a batch file rename a file to the date or time?" I used that information to create the folder. Here's what works for me: for /f "tokens=1-5 delims=/ " %%d in ("%date%") do md B:\Projects\Fire Behaviour Outputs\Hourly output %%g-%%e-%%f I used the path you had in your post in the string above. This will create a folder with the name YYYY-MM-DD (example 2011-03-28). In the original article I read they had the date as MM-DD-YYYY, but I prefer the year-month-day instead because if I have many folders, it's EASIER to sort them chronologically. The tokens for the date are %%e=month, %%f=day, & %%g=year. And if you want to add the day of the week, add %%d. I created the following "for /f "tokens=1-5 delims=/ " %%d in ("%date%") do md c:\users\bonz\bat\%%d-%%g-%%e-%%f", and the resulting folder name is "Mon-2011-03-28" Another thing. I noticed you are creating the folder in drive B. If this is a removable disk (floppy), you might want the bat file to check and make sure there is a disk in the drive. Such as if not exist b:\*.* echo THERE IS NO DISK IN DRIVE B.Thank you [BonzCXL] for your help But fixed date time now the code is
========================
cd B:\Projects\Fire Behaviour Outputs\Hourly output B:
@echo off echo D = Now : WScript.Echo Right(Year(D),4) _ >%temp%\today.vbs echo ^& Right(100+Month(D),2) ^& Right(100+Day(D),2) >>%temp%\today.vbs /f "tokens=1" %%a in ( 'cscript.exe //Nologo %temp%\today.vbs') do set today=%%a
del %temp%\today.vbs
echo Hi
echo saahmadbulbul, Todays date is : %today% md %today%
echo A folder has created for you; it is in ** B:\Projects\Fire Behaviour Outputs\Hourly output as todays date
==========================
but my main problem is to copy files to that folder. not it is yyyymmyy format
Thanks if you have any help ?Thanks [donlong88] for helping me with the codes.
Now i created 2 bat files to copy the files to two different network drives B: and R:
I would like to know I can combine those two bat files into one. I wrote
@echo off copy2B.bat copy2R.bat
but did not work.
Thanks
Here are the codes for copy2B.bat and copy2R.bat ****************************************
copy2B ====== @echo off CD\ cd B:\projects\Fire Behaviour Outputs\Hourly Output\%today%\HFI\ B:
rem want to copy 4 Folders with 168 jpeg files each
rem C:\Firemod\temp
rem to
rem "B:\projects\Fire Behaviour Outputs\Hourly Output\%today%"
rem where this folder has created using the following codes
echo D = Now : WScript.Echo Right(Year(D),4) _ >%temp%\today.vbs echo ^& Right(100+Month(D),2) ^& Right(100+Day(D),2) >>%temp%\today.vbs type %temp%\today.vbs pause
for /f "tokens=1" %%a in ( 'cscript.exe //Nologo %temp%\today.vbs') do set today=%%a
rem del %temp%\today.vbs
echo Hi
echo Firemode user, Todays date is : %today% pause cd "B:\projects\Fire Behaviour Outputs\Hourly Output\" md %today% md %today%\FBHI md %today%\HFI md %today%\min5ha md %today%\VI
cd %today%\FBHI dir copy C:\Firemod\temp\FBHI\*.jpg "B:\projects\Fire Behaviour Outputs\Hourly Output\%today%\FBHI\"
echo FBHI copied to B:\Fire Behaviour Outputs ...
cd %today%\HFI dir copy C:\Firemod\temp\HFI\*.jpg "B:\projects\Fire Behaviour Outputs\Hourly Output\%today%\HFI\"
echo HFI copied to B:\Fire Behaviour Outputs ...
cd %today%\MinutesTo5Ha dir copy C:\Firemod\temp\MinutesTo5Ha\*.jpg "B:\projects\Fire Behaviour Outputs\Hourly Output\%today%\min5ha\"
echo min5ha copied to B:\Fire Behaviour Outputs ...
cd %today%\VI dir copy C:\Firemod\temp\VI\*.jpg "B:\projects\Fire Behaviour Outputs\Hourly Output\%today%\VI\"
echo VI copied to B:\Fire Behaviour Outputs ...
rem echo Created a folder for you; it is "B:\projects\Fire Behaviour Outputs\Hourly Output\"
rem each day file name will change and I need to copy those files regular basis.
Cd\ C:
copy2R ======
@echo off CD\ cd "R:\50-SCC\05-StatePlanningSection\FireBehaviour\Fire Behaviour 2010_2011\SCC\Products\Fire Behaviour Briefing" R:
rem want to copy 3 Folders with 168 jpeg files each
rem C:\Firemod\temp
rem to
rem "R:\50-SCC\05-StatePlanningSection\FireBehaviour\Fire Behaviour 2010_2011\SCC\Products\Fire Behaviour Briefing\%today%"
rem where this folder has created using the following codes
echo D = Now : WScript.Echo Right(Year(D),4) _ >%temp%\today.vbs echo ^& Right(100+Month(D),2) ^& Right(100+Day(D),2) >>%temp%\today.vbs type %temp%\today.vbs pause
for /f "tokens=1" %%a in ( 'cscript.exe //Nologo %temp%\today.vbs') do set today=%%a
rem del %temp%\today.vbs
echo Hi
echo Firemode user, Todays date is : %today% pause cd "R:\50-SCC\05-StatePlanningSection\FireBehaviour\Fire Behaviour 2010_2011\SCC\Products\Fire Behaviour Briefing\" md %today% md %today%\FBHI md %today%\HFI md %today%\VI
cd %today%\FBHI dir copy C:\Firemod\temp\FBHI\*.jpg "R:\50-SCC\05-StatePlanningSection\FireBehaviour\Fire Behaviour 2010_2011\SCC\Products\Fire Behaviour Briefing\%today%\FBHI\"
echo FBHI copied to R:\Fire Behaviour Briefing
cd %today%\HFI dir copy C:\Firemod\temp\HFI\*.jpg "R:\50-SCC\05-StatePlanningSection\FireBehaviour\Fire Behaviour 2010_2011\SCC\Products\Fire Behaviour Briefing\%today%\HFI\"
echo HFI copied to R:\Fire Behaviour Briefing
cd %today%\VI dir copy C:\Firemod\temp\VI\*.jpg "R:\50-SCC\05-StatePlanningSection\FireBehaviour\Fire Behaviour 2010_2011\SCC\Products\Fire Behaviour Briefing\%today%\VI\"
echo VI copied to R:\Fire Behaviour Briefing
rem echo Created a folder for you; it is "R:\50-SCC\05-StatePlanningSection\FireBehaviour\Fire Behaviour 2010_2011\SCC\Products\Fire Behaviour Briefing\"
rem each day file name will change and I need to copy those files regular basis.
Cd\ C:
Done . Thanks every one.
|