diff --git a/scripts_old/0MoveToCurrent.bat b/scripts_old/0MoveToCurrent.bat new file mode 100644 index 0000000..de3c981 --- /dev/null +++ b/scripts_old/0MoveToCurrent.bat @@ -0,0 +1,64 @@ +@echo off +setlocal enabledelayedexpansion + +rem Get current directory +set "srcDir=%CD%" +echo Current directory: %srcDir% + +rem Get parent directory +for %%I in ("%srcDir%\..") do set "parentDir=%%~fI" +echo Parent directory: %parentDir% + +rem Set the _CURRENT directory +set "currentDir=%parentDir%\_CURRENT" +echo Target directory: %currentDir% + +rem Create _CURRENT directory if it doesn't exist +if not exist "%currentDir%" ( + echo Creating _CURRENT directory... + mkdir "%currentDir%" +) + +echo. +echo Looking for files in: %srcDir% +echo. + +set "fileFound=false" +for %%F in ("%srcDir%\*.*") do ( + rem Skip directories and the batch file itself + if not "%%~dpnxF"=="%~f0" if not "%%~aF:~0,1"=="d" ( + set "fileFound=true" + echo Found file: %%~nxF + + if not exist "%currentDir%\%%~nxF" ( + echo [NEW] Copying to _CURRENT... + copy "%%F" "%currentDir%\" + ) else ( + echo [EXISTS] Comparing dates... + for %%A in ("%%F") do set "sourceDate=%%~tA" + for %%B in ("%currentDir%\%%~nxF") do set "targetDate=%%~tB" + + echo Source date: !sourceDate! + echo Target date: !targetDate! + + rem Use PowerShell to properly compare file timestamps + powershell -Command "if ((Get-Item '%%F').LastWriteTime -gt (Get-Item '%currentDir%\%%~nxF').LastWriteTime) { exit 1 } else { exit 0 }" + if !errorlevel! equ 1 ( + echo [UPDATED] Source is newer, copying... + copy "%%F" "%currentDir%\" + ) else ( + echo [SKIP] Target is up to date or newer. + ) + ) + echo. + ) +) + +if "%fileFound%"=="false" ( + echo No files found in %srcDir% to process. + echo Make sure you're running this from the correct directory. +) + +echo. +echo Done! Press any key to exit. +pause > nul diff --git a/scripts_old/PushAllToCurrent.bat b/scripts_old/PushAllToCurrent.bat new file mode 100644 index 0000000..2535326 --- /dev/null +++ b/scripts_old/PushAllToCurrent.bat @@ -0,0 +1,48 @@ +@echo off +setlocal enabledelayedexpansion +echo PushAllToCurrent - Running all 0MoveToCurrent.bat files in daily_ folders... +echo. + +echo Searching for daily_ folders and 0MoveToCurrent.bat files... +echo. + +REM Find all daily_ folders and check for 0MoveToCurrent.bat +set /a count=0 +set /a found=0 + +echo Found the following daily_ folders with 0MoveToCurrent.bat: +for /d %%D in (daily_*) do ( + if exist "%%D\0MoveToCurrent.bat" ( + echo - %%D + set /a found+=1 + ) +) + +if !found!==0 ( + echo No daily_ folders with 0MoveToCurrent.bat found! + pause + exit /b 1 +) + +echo. +echo Found !found! folders with 0MoveToCurrent.bat files. +echo. +echo Starting execution... +echo. + +REM Execute each 0MoveToCurrent.bat found in daily_ folders +for /d %%D in (daily_*) do ( + if exist "%%D\0MoveToCurrent.bat" ( + set /a count+=1 + echo [!count!/!found!] Running 0MoveToCurrent.bat in %%D... + pushd "%%D" + call "0MoveToCurrent.bat" + popd + echo Completed: %%D + echo. + ) +) + +echo. +echo Operation completed. Successfully executed !count! batch files. +pause \ No newline at end of file diff --git a/scripts_old/RebuildDailies.bat b/scripts_old/RebuildDailies.bat new file mode 100644 index 0000000..f3ec307 --- /dev/null +++ b/scripts_old/RebuildDailies.bat @@ -0,0 +1,39 @@ +@echo off +echo RebuildDailies - Copying 0MoveToCurrent.bat to all daily_* folders... +echo. + +REM Check if source file exists +if not exist "A:\1 Amazon_Active_Projects\0MoveToCurrent.bat" ( + echo ERROR: Source file "A:\1 Amazon_Active_Projects\0MoveToCurrent.bat" not found! + pause + exit /b 1 +) + +REM Search for daily_* folders recursively +echo Searching for daily_* folders in all subfolders... +echo. + +REM Show which folders will be updated +echo Found the following daily_* folders: +for /f "delims=" %%D in ('dir /s /b /ad "*daily_*" 2^>nul') do echo - %%D + +echo. +echo Copying 0MoveToCurrent.bat to each folder... +echo. + +REM Copy the file to each daily_* folder found recursively +set /a count=0 +for /f "delims=" %%D in ('dir /s /b /ad "*daily_*" 2^>nul') do ( + echo Copying to %%D... + copy /Y "A:\1 Amazon_Active_Projects\0MoveToCurrent.bat" "%%D\" >nul + if errorlevel 1 ( + echo ERROR: Failed to copy to %%D + ) else ( + echo SUCCESS: Copied to %%D + set /a count+=1 + ) +) + +echo. +echo Operation completed. Successfully copied to %count% folders. +pause \ No newline at end of file