This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
start:chromateccode [2017/11/21 15:24] andre |
start:chromateccode [2017/12/15 12:21] (current) andre |
||
---|---|---|---|
Line 4: | Line 4: | ||
@echo off | @echo off | ||
@echo ------------------------------------ | @echo ------------------------------------ | ||
- | @echo Deleting old orders, checking for new batches and copying decoration files | ||
@echo 2017 Andr‚ Le Comte | @echo 2017 Andr‚ Le Comte | ||
timeout /t 10 | timeout /t 10 | ||
- | @echo ------------------------------------ | + | |
- | @echo Checking for any order folders that were modified more than seven days ago and deleting them. | + | @echo Checking for order folders that were modified more than seven days ago and deleting them: |
+ | @echo Decal | ||
ForFiles /P Y:\Orders\Decal /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\Decal /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo Embroidery | ||
ForFiles /P Y:\Orders\Embroidery /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\Embroidery /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo Heat transfer | ||
ForFiles /P Y:\Orders\Heat_transfer /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\Heat_transfer /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo Laser engraving | ||
+ | ForFiles /P Y:\Orders\Laser_engraving /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo Multiple | ||
ForFiles /P Y:\Orders\Multiple /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\Multiple /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo Other engraving | ||
ForFiles /P Y:\Orders\Other_engraving /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\Other_engraving /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo Rubber patch | ||
ForFiles /P Y:\Orders\Rubber_patch /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\Rubber_patch /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo Silk screen | ||
ForFiles /P Y:\Orders\Silk_screen /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\Silk_screen /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo U.V. | ||
ForFiles /P Y:\Orders\UV /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\UV /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
+ | @echo Wood engraving | ||
ForFiles /P Y:\Orders\Wood_engraving /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ForFiles /P Y:\Orders\Wood_engraving /D -7 /C "CMD /C if @ISDIR==TRUE echo RD /Q @FILE &RD /Q /S @FILE" | ||
- | @echo ------------------------------------ | + | @echo Searching for new batches. |
+ | @echo If batches are found then an attempt will be made to copy files for decoration. | ||
@echo Searching for new heat-transfer Chroma-Tec batches. | @echo Searching for new heat-transfer Chroma-Tec batches. | ||
if exist Y:\Batches\HT* (goto copy_ht) else (goto decal_check) | if exist Y:\Batches\HT* (goto copy_ht) else (goto decal_check) | ||
Line 38: | Line 49: | ||
:uv_check | :uv_check | ||
@echo Searching for new UV Chroma-Tec batches. | @echo Searching for new UV Chroma-Tec batches. | ||
- | if exist Y:\Batches\UV* (goto copy_uv) else (goto otherengraving_check) | + | if exist Y:\Batches\UV* (goto copy_uv) else (goto laserengraving_check) |
+ | :laserengraving_check | ||
+ | @echo Searching for new laser engraving batches. | ||
+ | if exist Y:\Batches\LE* (goto copy_le) else (goto otherengraving_check) | ||
:otherengraving_check | :otherengraving_check | ||
@echo Searching for new other engraving batches. | @echo Searching for new other engraving batches. | ||
if exist Y:\Batches\OE* (goto copy_oe) else (goto woodengraving_check) | if exist Y:\Batches\OE* (goto copy_oe) else (goto woodengraving_check) | ||
:woodengraving_check | :woodengraving_check | ||
- | @echo Searching for new wood engraving batches. If batches are found then an attempt will be made to copy files for decoration. | + | @echo Searching for new wood engraving batches. |
if exist Y:\Batches\WE* (goto copy_we) else (goto start) | if exist Y:\Batches\WE* (goto copy_we) else (goto start) | ||
:copy_ht | :copy_ht | ||
Line 66: | Line 80: | ||
MKDIR "Y:\Orders\Heat_transfer\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\Heat_transfer\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
- | set /a counter=0 | + | set /a ptcounter=0 |
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
- | set /a counter=!counter!+1 | + | set /a ptcounter=!ptcounter!+1 |
- | @echo %%~na_!counter!%%xa | + | @echo %%~na_file_!ptcounter!%%~xa |
- | copy "%%~a" "Y:\Orders\Heat_transfer\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | + | copy "%%~a" "Y:\Orders\Heat_transfer\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!ptcounter!%%~xa" |
) | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:copy_dc | :copy_dc | ||
Line 95: | Line 110: | ||
MKDIR "Y:\Orders\Decal\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\Decal\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
set /a counter=0 | set /a counter=0 | ||
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
Line 102: | Line 117: | ||
copy "%%~a" "Y:\Orders\Decal\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | copy "%%~a" "Y:\Orders\Decal\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
) | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:copy_em | :copy_em | ||
Line 124: | Line 140: | ||
MKDIR "Y:\Orders\Embroidery\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\Embroidery\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
set /a counter=0 | set /a counter=0 | ||
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
Line 131: | Line 147: | ||
copy "%%~a" "Y:\Orders\Embroidery\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | copy "%%~a" "Y:\Orders\Embroidery\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
) | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:copy_mu | :copy_mu | ||
Line 153: | Line 170: | ||
MKDIR "Y:\Orders\Multiple\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\Multiple\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
set /a counter=0 | set /a counter=0 | ||
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
Line 160: | Line 177: | ||
copy "%%~a" "Y:\Orders\Multiple\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | copy "%%~a" "Y:\Orders\Multiple\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
) | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:copy_rp | :copy_rp | ||
Line 182: | Line 200: | ||
MKDIR "Y:\Orders\Rubber_patch\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\Rubber_patch\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
set /a counter=0 | set /a counter=0 | ||
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
Line 189: | Line 207: | ||
copy "%%~a" "Y:\Orders\Rubber_patch\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | copy "%%~a" "Y:\Orders\Rubber_patch\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
) | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:copy_ss | :copy_ss | ||
Line 211: | Line 230: | ||
MKDIR "Y:\Orders\Silk_screen\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\Silk_screen\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
set /a counter=0 | set /a counter=0 | ||
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
Line 218: | Line 237: | ||
copy "%%~a" "Y:\Orders\Silk_screen\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | copy "%%~a" "Y:\Orders\Silk_screen\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
) | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:copy_uv | :copy_uv | ||
Line 240: | Line 260: | ||
MKDIR "Y:\Orders\UV\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\UV\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
set /a counter=0 | set /a counter=0 | ||
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
Line 247: | Line 267: | ||
copy "%%~a" "Y:\Orders\UV\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | copy "%%~a" "Y:\Orders\UV\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
) | ) | ||
+ | ENDLOCAL | ||
+ | goto delete | ||
+ | :copy_le | ||
+ | Y: | ||
+ | CD Y:\Batches | ||
+ | ren Y:\Batches\LE* *.txt | ||
+ | for /F "delims=" %%G in ("Y:\Batches\*.txt") do set "batch_file=%%~nxG" | ||
+ | set batch_number=%batch_file:~0,-4% | ||
+ | set hour=%time:~0,2% | ||
+ | if "%hour:~0,1%" == " " set hour=0%hour:~1,1% | ||
+ | set min=%time:~3,2% | ||
+ | if "%min:~0,1%" == " " set min=0%min:~1,1% | ||
+ | set secs=%time:~6,2% | ||
+ | if "%secs:~0,1%" == " " set secs=0%secs:~1,1% | ||
+ | set year=%date:~-4% | ||
+ | set month=%date:~4,2% | ||
+ | if "%month:~0,1%" == " " set month=0%month:~1,1% | ||
+ | set day=%date:~7,2% | ||
+ | set days=%date:~0,3% | ||
+ | if "%day:~0,1%" == " " set day=0%day:~1,1% | ||
+ | @echo Making order folder for batch %batch_number% | ||
+ | MKDIR "Y:\Orders\Laser_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
+ | @echo Copying files for batch %batch_number% | ||
+ | SETLOCAL enabledelayedexpansion | ||
+ | set /a counter=0 | ||
+ | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
+ | set /a counter=!counter!+1 | ||
+ | @echo %%~na_!counter!%%xa | ||
+ | copy "%%~a" "Y:\Orders\Laser_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
+ | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:copy_we | :copy_we | ||
Line 269: | Line 320: | ||
MKDIR "Y:\Orders\Wood_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\Wood_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
set /a counter=0 | set /a counter=0 | ||
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
Line 276: | Line 327: | ||
copy "%%~a" "Y:\Orders\Wood_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | copy "%%~a" "Y:\Orders\Wood_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
) | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:copy_oe | :copy_oe | ||
Line 298: | Line 350: | ||
MKDIR "Y:\Orders\Other_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | MKDIR "Y:\Orders\Other_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%" | ||
@echo Copying files for batch %batch_number% | @echo Copying files for batch %batch_number% | ||
- | SETLOCAL | + | SETLOCAL enabledelayedexpansion |
set /a counter=0 | set /a counter=0 | ||
FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | FOR /F %%a in (Y:\Batches\%batch_number%.txt) DO ( | ||
Line 305: | Line 357: | ||
copy "%%~a" "Y:\Orders\Other_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | copy "%%~a" "Y:\Orders\Other_engraving\%batch_number% %year%-%month%-%day% %hour%-%min% %days%\%%~na_file_!counter!%%~xa" | ||
) | ) | ||
+ | ENDLOCAL | ||
goto delete | goto delete | ||
:delete | :delete |