How to shell script a list of files with their modification time on mingw?

后端 未结 3 551
梦毁少年i
梦毁少年i 2020-12-22 04:52

Disclaimer: This question exists because of Unity3D and its library issue.

I\'ve tried getting current git-cache-meta.sh and use it on windows. It doesn\'t work.

3条回答
  •  心在旅途
    2020-12-22 05:22

    I found a big and convoluted, thus hard to port, and slow solution. Too slow. Waaaay too slow. Takes over a minute to go through my git, which have about 9k files. But, none the less, here it is, thanks to Dave Taylor, google and many man pages. Basically, use for and Dave's hack instead of find:

    git ls-files -d > .temp_gitcachemeta
    for s in $(git ls-files | grep -vf .temp_gitcachemeta | sed 's/ /_+_/g');
        do t="$(echo $s | sed s'/_+_/ /g')";
        echo "touch -c -m -d \"$(date -r "$t" +'%F %T')\" \"$t\"";
    done
    rm .temp_gitcachemeta ;;
    

    Using temp file here because it seems like mingw also doesn't support process substitution.

提交回复
热议问题