You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[scenario]/precip/[segment]-[scenario]-all.csv to [scenario]/precip/[segment]_precip.csv
Ex: nldas2/precip/N51105-nldas2-all.csv to nldas2/precip/N51105_precip.csv
Bash script to rename all files inside a given scenario directory (like /media/model/met/nldas2rst):
for j in precip temp et; do
for i in `ls $j/`; do
coverage=${i%%-*}
mv $j/$i $j/${coverage}_${j}.csv
done
done
Bash script to do so inside all scenario directories (like /media/model/met):
Note: I had to run this as me and sudo'd as Connor since renaming apparently is not something that NFS permissions allow on this shared drive. @COBrogan
Added 2 special cases to rename the "-weekly" and "-daily" csvs
b=/media/model/met
for d in `ls $b/`;do
for j in precip temp et; do
for i in `ls $b/$d/$j/`; do
coverage=${i%%-*}
if [[ "$coverage" == "$i" ]]; then
continue
fi
if [[ $i == *"-daily"* ]]; then
echo "mv $b/$d/$j/$i $b/$d/$j/${coverage}_${j}_daily.csv"
mv $b/$d/$j/$i $b/$d/$j/${coverage}_${j}_daily.csv
elif [[ $i == *"-weekly"* ]]; then
echo "mv $b/$d/$j/$i $b/$d/$j/${coverage}_${j}_weekly.csv"
mv $b/$d/$j/$i $b/$d/$j/${coverage}_${j}_weekly.csv
else
echo "mv $b/$d/$j/$i $b/$d/$j/${coverage}_${j}.csv"
mv $b/$d/$j/$i $b/$d/$j/${coverage}_${j}.csv
fi
done
done
done
The text was updated successfully, but these errors were encountered:
rburghol
changed the title
Clean up naming onventions
Clean up naming conventions
Dec 5, 2024
Moving files from:
[scenario]/precip/[segment]-[scenario]-all.csv
to[scenario]/precip/[segment]_precip.csv
nldas2/precip/N51105-nldas2-all.csv
tonldas2/precip/N51105_precip.csv
Bash script to rename all files inside a given scenario directory (like
/media/model/met/nldas2rst
):Bash script to do so inside all scenario directories (like
/media/model/met
):The text was updated successfully, but these errors were encountered: