Files
ProjectStructure_HOME/.specstory/history/2025-08-17_20-18Z-change-date-format-in-workflow-scripts.md
2025-08-17 14:27:16 -06:00

14 KiB

Change date format in workflow scripts (2025-08-17 20:18Z)

User

I'm adapting these workflow scripts for home projects. Let's start with making sure that dates are not in YYMMDD format, but in YYYY-MM-DD format.


Assistant

I'll help you update the workflow scripts to use YYYY-MM-DD date format instead of YYMMDD. Let me first examine the existing scripts to see which ones contain date formatting that needs to be updated.


Grep search for "YYMMDD|YY-MM-DD|date.*format" • **3** files
File Line Match
file:///d%3A/3%20ProjectStructure/NewDaily.bat L4 :: Get current date in YYMMDD format
file:///d%3A/3%20ProjectStructure/NewProject.bat L4 :: Get current date in YYMMDD format
file:///d%3A/3%20ProjectStructure/NewProject.bat L4 :: Get current date in YYMMDD format

Now let me examine these files to see the current date formatting implementation:


Read file: NewDaily.bat


Read file: NewProject.bat


Let me also check if there are any other scripts that might have date formatting:


Grep search for "daily_|_%yy%|%yy%%mm%" • **7** files
File Line Match
file:///d%3A/3%20ProjectStructure/NewDaily.bat L13 mkdir "daily_%yy%%mm%%dd%"
file:///d%3A/3%20ProjectStructure/NewDaily.bat L14 echo Daily folder created: daily_%yy%%mm%%dd%
file:///d%3A/3%20ProjectStructure/UpdateSequences.bat L23 for /d %%D in (daily_*) do (
file:///d%3A/3%20ProjectStructure/scripts_old/PushAllToCurrent.bat L3 echo PushAllToCurrent - Running all 0MoveToCurrent.bat files in daily_ folders...
file:///d%3A/3%20ProjectStructure/scripts_old/PushAllToCurrent.bat L6 echo Searching for daily_ folders and 0MoveToCurrent.bat files...
file:///d%3A/3%20ProjectStructure/scripts_old/PushAllToCurrent.bat L9 REM Find all daily_ folders and check for 0MoveToCurrent.bat
file:///d%3A/3%20ProjectStructure/scripts_old/PushAllToCurrent.bat L13 echo Found the following daily_ folders with 0MoveToCurrent.bat:
file:///d%3A/3%20ProjectStructure/scripts_old/PushAllToCurrent.bat L14 for /d %%D in (daily_*) do (
file:///d%3A/3%20ProjectStructure/scripts_old/PushAllToCurrent.bat L22 echo No daily_ folders with 0MoveToCurrent.bat found!
file:///d%3A/3%20ProjectStructure/scripts_old/PushAllToCurrent.bat L33 REM Execute each 0MoveToCurrent.bat found in daily_ folders
file:///d%3A/3%20ProjectStructure/scripts_old/PushAllToCurrent.bat L34 for /d %%D in (daily_*) do (
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L9 :: - Collects seq/ outputs from daily_* folders under Blends\animations (with submodule support)
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L92 :: Collect seq outputs from daily_* into Renders
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L100 :: Detect submodules: first-level folders under animations that contain daily_*
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L104 if /I not "!prefix!"=="daily_" (
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L105 for /d %%D in ("%%S\daily_*") do (
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L109 if exist "%%S\daily_*" echo [DRY] Detected submodule: "%%~nS"
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L119 if /I not "!prefix!"=="daily_" (
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L132 for /d %%D in ("%%S\daily_*") do (
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L152 if "%DRY%"=="1" echo [DRY] No submodules found; using direct daily_* under animations
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L153 :: Fallback: direct daily_* under animations → copy into Renders\daily_*
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L154 for /d %%D in ("%animDir%\daily_*") do (
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L175 if "%DRY%"=="1" echo [DRY] Animations dir missing or empty; checking root daily_*
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L176 :: Final fallback: root-level daily_* under projectDir → copy into Renders\daily_*
file:///d%3A/3%20ProjectStructure/UpgradeToGitProj.bat L177 for /d %%D in ("%projectDir%\daily_*") do (
file:///d%3A/3%20ProjectStructure/scripts_old/RebuildDailies.bat L2 echo RebuildDailies - Copying 0MoveToCurrent.bat to all daily_* folders...
file:///d%3A/3%20ProjectStructure/scripts_old/RebuildDailies.bat L12 REM Search for daily_* folders recursively
file:///d%3A/3%20ProjectStructure/scripts_old/RebuildDailies.bat L13 echo Searching for daily_* folders in all subfolders...
file:///d%3A/3%20ProjectStructure/scripts_old/RebuildDailies.bat L17 echo Found the following daily_* folders:
file:///d%3A/3%20ProjectStructure/scripts_old/RebuildDailies.bat L18 for /f "delims=" %%D in ('dir /s /b /ad "*daily_*" 2^>nul') do echo - %%D
file:///d%3A/3%20ProjectStructure/scripts_old/RebuildDailies.bat L24 REM Copy the file to each daily_* folder found recursively
file:///d%3A/3%20ProjectStructure/scripts_old/RebuildDailies.bat L26 for /f "delims=" %%D in ('dir /s /b /ad "*daily_*" 2^>nul') do (
file:///d%3A/3%20ProjectStructure/NewProject.bat L15 set projectRoot=%yy%%mm%%dd%_%projectName%
file:///d%3A/3%20ProjectStructure/NewProject.bat L15 set projectRoot=%yy%%mm%%dd%_%projectName%

Now I can see the scope of changes needed. I need to update the date formatting in both NewDaily.bat and NewProject.bat to use YYYY-MM-DD format instead of YYMMDD. Let me update these files:


Edit file: NewDaily.bat

I will update the date formatting from YYMMDD to YYYY-MM-DD format by modifying the date parsing and folder naming logic.

Chunk 1 Lines added: 4, lines removed: 4

@@ -2,15 +2,15 @@
  setlocal
  
- :: Get current date in YYMMDD format
+ :: Get current date in YYYY-MM-DD format
  for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (
      set mm=%%a
      set dd=%%b
      set yy=%%c
  )
- set yy=%yy:~-2%
+ set yyyy=20%yy:~-2%
  
  :: Create daily folder
- mkdir "daily_%yy%%mm%%dd%"
- echo Daily folder created: daily_%yy%%mm%%dd%
+ mkdir "daily_%yyyy%-%mm%-%dd%"
+ echo Daily folder created: daily_%yyyy%-%mm%-%dd%
  
  pause

Edit file: NewProject.bat

I will update the date formatting from YYMMDD to YYYY-MM-DD format by modifying the date parsing and project root naming logic.

Chunk 1 Lines added: 3, lines removed: 3

@@ -2,16 +2,16 @@
  setlocal
  
- :: Get current date in YYMMDD format
+ :: Get current date in YYYY-MM-DD format
  for /f "tokens=2-4 delims=/ " %%a in ('date /t') do (
      set mm=%%a
      set dd=%%b
      set yy=%%c
  )
- set yy=%yy:~-2%
+ set yyyy=20%yy:~-2%
  
  :: Ask for project name
  set /p projectName="Enter project name (press Enter for default 'NewProject'): "
  if "%projectName%"=="" set projectName=NewProject
- set projectRoot=%yy%%mm%%dd%_%projectName%
+ set projectRoot=%yyyy%-%mm%-%dd%_%projectName%
  
  :: Create main project directory

Perfect! I've successfully updated both scripts to use YYYY-MM-DD date format instead of YYMMDD. Here's a summary of the changes made:

Changes Made:

NewDaily.bat:

  • Updated comment from "YYMMDD format" to "YYYY-MM-DD format"
  • Changed set yy=%yy:~-2% to set yyyy=20%yy:~-2% to get full 4-digit year
  • Updated folder naming from daily_%yy%%mm%%dd% to daily_%yyyy%-%mm%-%dd%

NewProject.bat:

  • Updated comment from "YYMMDD format" to "YYYY-MM-DD format"
  • Changed set yy=%yy:~-2% to set yyyy=20%yy:~-2% to get full 4-digit year
  • Updated project root naming from %yy%%mm%%dd%_%projectName% to %yyyy%-%mm%-%dd%_%projectName%

What This Means:

  • Before: Daily folders were named like daily_231215 (December 15, 2023)

  • After: Daily folders will now be named like daily_2023-12-15

  • Before: Project folders were named like 231215_ProjectName

  • After: Project folders will now be named like 2023-12-15_ProjectName

The scripts will now create folders with ISO 8601 compliant date formatting (YYYY-MM-DD), which is more readable and follows international standards. All the existing scripts that search for daily_* patterns will continue to work since they use wildcard matching.


User

we need these paths to be changed to work no matter where they're ran; relative paths.


Assistant

I can see that you've made some changes to the scripts, and now you need the paths to be relative so they work regardless of where they're run from. Let me examine the current state of the files and update them to use relative paths.


Read file: NewDaily.bat


Read file: NewProject.bat


I can see the issues. The NewProject.bat script has several hardcoded absolute paths that need to be converted to relative paths. Let me update both scripts to use relative paths that will work from any location.

First, let me fix the NewDaily.bat script to ensure consistency:


Edit file: NewDaily.bat

I will fix the inconsistency between the folder creation and the echo message to use the same naming format.

Chunk 1 Lines added: 1, lines removed: 1

@@ -12,5 +12,5 @@
  :: Create daily folder
  mkdir "%yyyy%-%mm%-%dd%"
- echo Daily folder created: daily_%yyyy%-%mm%-%dd%
+ echo Daily folder created: %yyyy%-%mm%-%dd%
  
  pause

Now let me update the NewProject.bat script to use relative paths instead of the hardcoded absolute paths:


Edit file: NewProject.bat

I will replace all hardcoded absolute paths with relative paths using %~dp0 to reference the script's directory, making the script portable.

Chunk 1 Lines added: 2, lines removed: 2

@@ -20,8 +20,8 @@
  :: Create Assets structure
  mkdir "%projectRoot%\Assets\ElevenLabs"
- if exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\NewDaily.bat" copy /Y "A:\1 Amazon_Active_Projects\3 ProjectStructure\NewDaily.bat" "%projectRoot%\Assets\ElevenLabs\NewDaily.bat" >nul
+ if exist "%~dp0NewDaily.bat" copy /Y "%~dp0NewDaily.bat" "%projectRoot%\Assets\ElevenLabs\NewDaily.bat" >nul
  mkdir "%projectRoot%\Assets\Blends"
  mkdir "%projectRoot%\Assets\VO"
- if exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\NewDaily.bat" copy /Y "A:\1 Amazon_Active_Projects\3 ProjectStructure\NewDaily.bat" "%projectRoot%\Assets\VO\NewDaily.bat" >nul
+ if exist "%~dp0NewDaily.bat" copy /Y "%~dp0NewDaily.bat" "%projectRoot%\Assets\VO\NewDaily.bat" >nul
  
  :: Create Deliverable structure

Chunk 2 Lines added: 4, lines removed: 4

@@ -35,10 +35,10 @@
  
  :: Place helper scripts into Renders
- if exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\NewDaily.bat" copy /Y "A:\1 Amazon_Active_Projects\3 ProjectStructure\NewDaily.bat" "%projectRoot%\Renders\NewDaily.bat" >nul
- if exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.bat" copy /Y "A:\1 Amazon_Active_Projects\3 ProjectStructure\UpdateSequences.bat" "%projectRoot%\Renders\UpdateSequences.bat" >nul
+ if exist "%~dp0NewDaily.bat" copy /Y "%~dp0NewDaily.bat" "%projectRoot%\Renders\NewDaily.bat" >nul
+ if exist "%~dp0UpdateSequences.bat" copy /Y "%~dp0UpdateSequences.bat" "%projectRoot%\Renders\UpdateSequences.bat" >nul
  
  :: Use repo-provided templates for git config files
- if exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\components\gitignore" copy /Y "A:\1 Amazon_Active_Projects\3 ProjectStructure\components\gitignore" "%projectRoot%\.gitignore" >nul
- if exist "A:\1 Amazon_Active_Projects\3 ProjectStructure\components\gitattributes" copy /Y "A:\1 Amazon_Active_Projects\3 ProjectStructure\components\gitattributes" "%projectRoot%\.gitattributes" >nul
+ if exist "%~dp0components\gitignore" copy /Y "%~dp0components\gitignore" "%projectRoot%\.gitignore" >nul
+ if exist "%~dp0components\gitattributes" copy /Y "%~dp0components\gitattributes" "%projectRoot%\.gitattributes" >nul
  
  :: Initialize git and install Git LFS

Perfect! I've successfully updated both scripts to use relative paths. Here's what I changed:

Changes Made:

NewDaily.bat:

  • Fixed the inconsistency between folder creation and echo message
  • Now both the folder name and the echo message use the same format: %yyyy%-%mm%-%dd%

NewProject.bat:

  • Replaced all hardcoded absolute paths (A:\1 Amazon_Active_Projects\3 ProjectStructure\) with relative paths using %~dp0
  • %~dp0 is a Windows batch variable that represents the directory where the script is located

What This Means:

Before: The script would only work when run from a specific location (A:\1 Amazon_Active_Projects\3 ProjectStructure\)

After: The script will work from any location because it uses relative paths based on where the script file itself is located

Key Benefits:

  1. Portability: You can now copy these scripts to any location and they'll work correctly
  2. Flexibility: The scripts will find their dependencies (like NewDaily.bat, UpdateSequences.bat, and the components folder) relative to their own location
  3. No more hardcoded paths: All paths are now dynamic and will work regardless of where you run the scripts from

The scripts will now work whether you run them from:

  • The original project structure directory
  • A USB drive
  • Any other location where you've copied the scripts and their supporting files