ARMmbed / mbed-littlefs

[experimental] Mbed OS wrapper for LittleFS v2.0 (alpha)
https://github.com/ARMmbed/littlefs
76 stars 34 forks source link

upgrade script from main repo #13

Closed pilotak closed 4 years ago

pilotak commented 5 years ago

@geky as per our previous conversation about upgrade to V2 from main repo here is a script for autorenaming all required files. Just create this file in main repo, run and copy the result back this repo

#!/bin/bash

for fullpath in $(find ./ -type f); do
    # echo "Processing file ${fullpath}"

    # replace string lfs with lfs2 (it renames lfs1 to lfs21, correction is applied)
    sed -i -e 's/lfs/lfs2/g;s/LFS/LFS2/g;s/lfs21/lfs2/g;s/LFS21/LFS2/g' $fullpath

    # rename files begins with lfs* to lfs2*
    filename="${fullpath##*/}"

    if  [[ $filename == lfs* ]]; then
        new_path="${fullpath:0:${#fullpath} - ${#filename}}${filename:0:3}2${filename:3}"
        mv $fullpath $new_path
        # echo "Renamed ${fullpath} -> ${new_path}"
    fi
done