User Tools

Site Tools


takeoutphotosanitizer:uncertain_reclassification_workflow_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
takeoutphotosanitizer:uncertain_reclassification_workflow_guide [2026/02/23 17:08] – [(선택) 향후 확장을 위한 주석 파일] hyjeongtakeoutphotosanitizer:uncertain_reclassification_workflow_guide [2026/02/24 17:08] (current) – [1단계 – _Uncertain 목록 추출] hyjeong
Line 44: Line 44:
 $out = "_ops\reclass\uncertain_review.csv" $out = "_ops\reclass\uncertain_review.csv"
  
-Get-ChildItem $unc -File -Recurse |+if (!(Test-Path -LiteralPath $unc)) { 
 +    throw "_Uncertain 폴더가 없습니다: $unc" 
 +
 + 
 +Get-ChildItem -LiteralPath $unc -File -Recurse |
 Select-Object FullName, Name, Length, LastWriteTime | Select-Object FullName, Name, Length, LastWriteTime |
-Export-Csv $out -NoTypeInformation -Encoding UTF8+Export-Csv -LiteralPath $out -NoTypeInformation -Encoding utf8BOM
 </code> </code>
  
Line 131: Line 135:
 # 작업 디렉토리(= Photos_Backup)에서 실행한다고 가정 # 작업 디렉토리(= Photos_Backup)에서 실행한다고 가정
  
-$in  = "_ops\reclass\uncertain_review_done.csv"+$in        = "_ops\reclass\uncertain_review_done.csv"
 $rootMedia = "From_Google_Takeout" $rootMedia = "From_Google_Takeout"
-$log = "_ops\reclass\move_log.tsv"+$log       = "_ops\reclass\move_log.tsv"
  
 # 입력 파일 확인 # 입력 파일 확인
Line 148: Line 152:
 $logDir = Split-Path -Parent $log $logDir = Split-Path -Parent $log
 if (!(Test-Path -LiteralPath $logDir)) { New-Item -ItemType Directory -Path $logDir -Force | Out-Null } if (!(Test-Path -LiteralPath $logDir)) { New-Item -ItemType Directory -Path $logDir -Force | Out-Null }
 +
 +# 카운터(요약 출력용)
 +$cnt_total  = 0
 +$cnt_skip   = 0
 +$cnt_moved  = 0
 +$cnt_failed = 0
  
 Import-Csv -LiteralPath $in | Import-Csv -LiteralPath $in |
 ForEach-Object { ForEach-Object {
 +
 +    $cnt_total++
  
     # year_final 정리(공백 제거)     # year_final 정리(공백 제거)
     $yy = ("" + $_.year_final).Trim()     $yy = ("" + $_.year_final).Trim()
-    if ($yy -notmatch '^\d{4}$') { return }+    if ($yy -notmatch '^\d{4}$') { $cnt_skip++; return }
  
     # 원본 파일 경로 확인     # 원본 파일 경로 확인
     $src = $_.FullName     $src = $_.FullName
-    if ([string]::IsNullOrWhiteSpace($src)) { return } +    if ([string]::IsNullOrWhiteSpace($src)) { $cnt_skip++; return } 
-    if (!(Test-Path -LiteralPath $src)) { return }+    if (!(Test-Path -LiteralPath $src)) { $cnt_skip++; return } 
 + 
 +    # 안전장치: _Uncertain 내부 파일만 이동(의도치 않은 이동 방지) 
 +    # (대소문자 무시, 경로 구분자 혼용을 감안해 \\ 와 / 모두 허용) 
 +    if ($src -notmatch '[\\/]+From_Google_Takeout[\\/]+_Uncertain[\\/]+') { $cnt_skip++; return }
  
     # 목적 연도 폴더 생성     # 목적 연도 폴더 생성
Line 180: Line 196:
     try {     try {
         Move-Item -LiteralPath $src -Destination $dst -ErrorAction Stop         Move-Item -LiteralPath $src -Destination $dst -ErrorAction Stop
 +        $cnt_moved++
     }     }
     catch {     catch {
         $status = "move_failed: " + ($_.Exception.Message -replace "(\r\n|\n|\r)", " " -replace "`t"," ")         $status = "move_failed: " + ($_.Exception.Message -replace "(\r\n|\n|\r)", " " -replace "`t"," ")
 +        $cnt_failed++
     }     }
  
Line 189: Line 207:
     $dstLog = ($dst -replace "`t"," " -replace "(\r\n|\n|\r)"," ")     $dstLog = ($dst -replace "`t"," " -replace "(\r\n|\n|\r)"," ")
  
-    "{0}`t{1}`t{2}`t{3}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"), $srcLog, $dstLog, $status |+    # 로그 형식: time, year_final, src, dst, status 
 +    "{0}`t{1}`t{2}`t{3}`t{4}" -f (Get-Date -Format "yyyy-MM-dd HH:mm:ss"), $yy, $srcLog, $dstLog, $status |
       Add-Content -LiteralPath $log -Encoding UTF8       Add-Content -LiteralPath $log -Encoding UTF8
 } }
 +
 +# 요약 출력
 +Write-Host ("[MOVE] total={0} moved={1} failed={2} skipped={3}  log={4}" -f $cnt_total, $cnt_moved, $cnt_failed, $cnt_skip, $log)
 </code> </code>
  
takeoutphotosanitizer/uncertain_reclassification_workflow_guide.1771834099.txt.gz · Last modified: by hyjeong