149 lines
3.8 KiB
Markdown
149 lines
3.8 KiB
Markdown
|
|
<!-- Generated by SpecStory -->
|
||
|
|
|
||
|
|
# Ignore folders named _archive (2025-08-18 21:09Z)
|
||
|
|
|
||
|
|
_**User**_
|
||
|
|
|
||
|
|
make sure it ignores folders named `_archive`
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
_**Assistant**_
|
||
|
|
|
||
|
|
I'll modify the `UpdateSequences.bat` script to ignore folders named `_archive`. Looking at the current script, I need to add a check to skip any daily folders that are named `_archive`.
|
||
|
|
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
<details><summary>Edit file: UpdateSequences.bat</summary>
|
||
|
|
|
||
|
|
undefined
|
||
|
|
|
||
|
|
**Chunk 1**
|
||
|
|
Lines added: 5, lines removed: undefined
|
||
|
|
|
||
|
|
```diff
|
||
|
|
@@ -23,4 +23,9 @@
|
||
|
|
for /d %%D in (daily_*) do (
|
||
|
|
if exist "%%D" (
|
||
|
|
+ rem Skip _archive folders
|
||
|
|
+ if "%%~nxD"=="_archive" (
|
||
|
|
+ echo Skip: archive folder "%%D"
|
||
|
|
+ goto :continue
|
||
|
|
+ )
|
||
|
|
set /a dailiesScanned+=1
|
||
|
|
set "hadSub=0"
|
||
|
|
```
|
||
|
|
|
||
|
|
**Chunk 2**
|
||
|
|
Lines added: 1, lines removed: undefined
|
||
|
|
|
||
|
|
```diff
|
||
|
|
@@ -37,4 +42,5 @@
|
||
|
|
)
|
||
|
|
)
|
||
|
|
+ :continue
|
||
|
|
)
|
||
|
|
|
||
|
|
```
|
||
|
|
|
||
|
|
</details>
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
Perfect! I've updated the `UpdateSequences.bat` script to ignore folders named `_archive`. The changes I made:
|
||
|
|
|
||
|
|
1. **Added a check** for `_archive` folders before processing any daily folder
|
||
|
|
2. **Added a skip message** to show when an archive folder is being skipped
|
||
|
|
3. **Added a `:continue` label** to jump to the next iteration when an archive folder is encountered
|
||
|
|
|
||
|
|
Now when the script runs, it will:
|
||
|
|
- Check if each daily folder is named `_archive`
|
||
|
|
- If it is, display a skip message and continue to the next folder
|
||
|
|
- If it's not `_archive`, process it normally as before
|
||
|
|
|
||
|
|
This ensures that `_archive` folders are completely ignored during the sequence update process, which should prevent any unwanted processing of archived content.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
_**User**_
|
||
|
|
|
||
|
|
now it instacloses.
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
_**Assistant**_
|
||
|
|
|
||
|
|
I see the issue! The problem is with the `goto :continue` statement. In batch files, when you use `goto` inside a loop, it can cause issues with the loop structure and cause the script to exit prematurely.
|
||
|
|
|
||
|
|
Let me fix this by using a different approach - I'll use an `if` statement with `else` instead of `goto`:
|
||
|
|
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
<details><summary>Edit file: UpdateSequences.bat</summary>
|
||
|
|
|
||
|
|
undefined
|
||
|
|
|
||
|
|
**Chunk 1**
|
||
|
|
Lines added: 16, lines removed: 17
|
||
|
|
|
||
|
|
```diff
|
||
|
|
@@ -24,23 +24,22 @@
|
||
|
|
if exist "%%D" (
|
||
|
|
rem Skip _archive folders
|
||
|
|
- if "%%~nxD"=="_archive" (
|
||
|
|
- echo Skip: archive folder "%%D"
|
||
|
|
- goto :continue
|
||
|
|
- )
|
||
|
|
- set /a dailiesScanned+=1
|
||
|
|
- set "hadSub=0"
|
||
|
|
- rem Case 1: subfolders treated as sequences
|
||
|
|
- for /d %%S in ("%%D\*") do (
|
||
|
|
- set /a sequencesTotal+=1
|
||
|
|
- set "hadSub=1"
|
||
|
|
- call :MirrorOne "%%D\%%~nxS" "%%~nxS"
|
||
|
|
- )
|
||
|
|
- rem Case 2: no subfolders => mirror daily itself as a sequence
|
||
|
|
- if "!hadSub!"=="0" (
|
||
|
|
- set /a sequencesTotal+=1
|
||
|
|
- call :MirrorOne "%%D" "%%~nxD"
|
||
|
|
+ if not "%%~nxD"=="_archive" (
|
||
|
|
+ set /a dailiesScanned+=1
|
||
|
|
+ set "hadSub=0"
|
||
|
|
+ rem Case 1: subfolders treated as sequences
|
||
|
|
+ for /d %%S in ("%%D\*") do (
|
||
|
|
+ set /a sequencesTotal+=1
|
||
|
|
+ set "hadSub=1"
|
||
|
|
+ call :MirrorOne "%%D\%%~nxS" "%%~nxS"
|
||
|
|
+ )
|
||
|
|
+ rem Case 2: no subfolders => mirror daily itself as a sequence
|
||
|
|
+ if "!hadSub!"=="0" (
|
||
|
|
+ set /a sequencesTotal+=1
|
||
|
|
+ call :MirrorOne "%%D" "%%~nxD"
|
||
|
|
+ )
|
||
|
|
+ ) else (
|
||
|
|
+ echo Skip: archive folder "%%D"
|
||
|
|
)
|
||
|
|
)
|
||
|
|
- :continue
|
||
|
|
)
|
||
|
|
|
||
|
|
```
|
||
|
|
|
||
|
|
</details>
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
Perfect! I've fixed the issue by removing the problematic `goto :continue` statement and restructuring the logic. Now the script:
|
||
|
|
|
||
|
|
1. **Uses a proper `if/else` structure** instead of `goto`
|
||
|
|
2. **Only processes folders that are NOT `_archive`** using `if not "%%~nxD"=="_archive"`
|
||
|
|
3. **Shows the skip message** in the `else` block when an archive folder is encountered
|
||
|
|
4. **Maintains the proper loop structure** so the script won't close instantly
|
||
|
|
|
||
|
|
The script should now run properly without closing immediately, and it will still ignore any folders named `_archive` as requested.
|
||
|
|
|
||
|
|
---
|
||
|
|
|