This commit is contained in:
1 parent
47d608deb0
commit
5a7740c729
2 files changed
+83
-8
No files matched your search
+39
-8
@@ -1,26 +1,57 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Set the output file
|
||||
# Nastavitev imena izhodne datoteke
|
||||
OUTPUT_FILE="code_export.txt"
|
||||
|
||||
# Remove the output file if it exists
|
||||
# Odstrani izhodno datoteko, če že obstaja, da začnemo s čisto datoteko
|
||||
if [ -f "$OUTPUT_FILE" ]; then
|
||||
rm "$OUTPUT_FILE"
|
||||
fi
|
||||
|
||||
# Find all files except hidden files and directories
|
||||
find . -type f -not -path "*/\.*" -not -path "*node_modules*" -not -path "*vendor*" | sort | while read -r file; do
|
||||
# Skip the output file itself and this script
|
||||
# Poišči vse datoteke, razen skritih datotek in določenih map (npr. node_modules).
|
||||
# Dodane so izjeme za slike, videoposnetke, PDF-je, arhive in druge binarne datoteke
|
||||
# neposredno v ukaz 'find' za boljšo zmogljivost.
|
||||
find . -type f \
|
||||
-not -path "*/\.*" \
|
||||
-not -path "*node_modules*" \
|
||||
-not -path "*vendor*" \
|
||||
-not -path "*dist*" \
|
||||
-not -path "*build*" \
|
||||
-not -name "*.jpg" -not -name "*.jpeg" \
|
||||
-not -name "*.png" -not -name "*.gif" \
|
||||
-not -name "*.bmp" -not -name "*.tiff" \
|
||||
-not -name "*.svg" -not -name "*.ico" \
|
||||
-not -name "*.webp" \
|
||||
-not -name "*.mp4" -not -name "*.mov" \
|
||||
-not -name "*.avi" -not -name "*.mkv" \
|
||||
-not -name "*.webm" \
|
||||
-not -name "*.mp3" -not -name "*.wav" \
|
||||
-not -name "*.ogg" -not -name "*.flac" \
|
||||
-not -name "*.pdf" \
|
||||
-not -name "*.zip" \
|
||||
-not -name "*.tar" \
|
||||
-not -name "*.gz" \
|
||||
-not -name "*.bz2" \
|
||||
-not -name "*.rar" \
|
||||
-not -name "*.7z" \
|
||||
-not -name "*.doc" -not -name "*.docx" \
|
||||
-not -name "*.xls" -not -name "*.xlsx" \
|
||||
-not -name "*.ppt" -not -name "*.pptx" \
|
||||
-not -name "*.eot" -not -name "*.ttf" \
|
||||
-not -name "*.woff" -not -name "*.woff2" \
|
||||
| sort | while read -r file; do
|
||||
|
||||
# Preskoči samo izhodno datoteko in to skripto
|
||||
if [[ "$file" == "./$OUTPUT_FILE" || "$file" == "./export_code.sh" ]]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Skip binary files and the output file itself
|
||||
# Dodatna varnostna preverba: preskoči binarne datoteke, ki jih 'find' morda ni ujel
|
||||
if file "$file" | grep -q "binary"; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# Add the filename and content to the output file
|
||||
# Dodaj ime datoteke in njeno vsebino v izhodno datoteko
|
||||
echo "\"$file\" : " >> "$OUTPUT_FILE"
|
||||
echo "\"\"\"" >> "$OUTPUT_FILE"
|
||||
cat "$file" >> "$OUTPUT_FILE"
|
||||
@@ -29,4 +60,4 @@ find . -type f -not -path "*/\.*" -not -path "*node_modules*" -not -path "*vendo
|
||||
echo "" >> "$OUTPUT_FILE"
|
||||
done
|
||||
|
||||
echo "Code export completed. Output saved to $OUTPUT_FILE"
|
||||
echo "Izvoz kode končan. Vsebina je shranjena v datoteko $OUTPUT_FILE"
|
||||
Reference in new issue
Block a user