I have little problem with my bash script. The script is cloning repositories to my local folder and then search for files with specified extensions in those repositories (results are CSVtemporary2/ASSETS-LIST-"$dir".csv) , then edits results (cuts first 4 elements of paths, results are:/CSVtoGD2/"$dir".csv)
In the CSV there are paths to files in every single row ex. /users/krzysztofpaszta/temporaryprojects/gamex/car1.png /users/krzysztofpaszta/temporaryprojects/gamex/sound1.mp3 (...)
Every part of the script is working fine but after cutting the first 4 elements of paths the first row is deleted.. I do not know why this is happening.
So results should be:
/car1.png
/sound1.mp3 (...)
But results are:
/sound1.mp3 (...)
I do not know why this is happening.
So in other words, files CSVtemporary2/ASSETS-LIST-"$dir".csv are fine but then, files /CSVtoGD2/"$dir".csv have first row deleted.. Someone has idea why this is happening?
#!/bin/bash
rm -vrf /Users/krzysztofpaszta/CSVtoGD2/*
rm -vrf /Users/krzysztofpaszta/CSVtemporary2/*
cd /Users/krzysztofpaszta/temporaryprojects
for repo in $(cat /users/krzysztofpaszta/repolinks.csv); do
git clone "$repo"
dir=${repo##*/}
find /users/krzysztofpaszta/temporaryprojects/"$dir" -name "*.fnt" -o -name "*.png" -o -name "*.ttf" -o -name "*.asset" -o -name "*.jpeg" -o -name "*.tga" -o -name "*.tif" -o -name "*.bmp" -o -name "*.jpg" -o -name "*.fbx" -o -name "*.prefab" -o -name "*.flare" -o -name "*.ogg" -o -name "*.wav" -o -name "*.anim" -o -name "*.mp3" -o -name "*.tiff" -o -name "*.otf" -o -name "*.hdr" >> /users/krzysztofpaszta/CSVtemporary2/ASSETS-LIST-"$dir".csv
while read in ; do
cut -d'/' -f6- >> /users/krzysztofpaszta/CSVtoGD2/"$dir".csv #| awk 'BEGIN{print"//"}1' - adding first empty row is not the solution, first row with text is still deleted
done < /users/krzysztofpaszta/CSVtemporary2/ASSETS-LIST-"$dir".csv
done
#rm -vrf /Users/krzysztofpaszta/temporaryprojects/*
#echo Repo deleted