Last active
July 21, 2025 23:06
-
-
Save halityurttas/dd27f6de045c0b6759dd62f54a042491 to your computer and use it in GitHub Desktop.
Path copy with hierarcy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Hedef dizin | |
| hedef_dizin="C:/Depo/gitbackup" | |
| # Git'te modify edilmiş ve untracked dosyaları al | |
| modified_files=$(git diff --name-only) | |
| untracked_files=$(git ls-files --others --exclude-standard) | |
| # Tüm değişiklikleri birleştir | |
| all_files="$modified_files $untracked_files" | |
| # Her dosya için işlem yap | |
| for file in $all_files; do | |
| if [ -f "$file" ]; then # Sadece dosyaları işle | |
| # Hedef dizini oluştur (eğer yoksa) | |
| mkdir -p "$hedef_dizin/$(dirname "$file")" | |
| # Dosyayı kopyala | |
| cp "./$file" "$hedef_dizin/$file" | |
| echo "$file kopyalandı" | |
| fi | |
| done | |
| echo "Tüm değiştirilmiş ve takip edilmeyen dosyalar başarıyla kopyalandı!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment