Loading [MathJax]/jax/output/HTML-CSS/jax.js

Thursday, August 20, 2020

Copy all lastly updated files into a single directory if the version control is horribly not done by git:

Instantiate a git repository (don't need to connect to any remote branch, do everything locally). Create a .sh file at the current directory, and paste:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
 
git add .
git status
 
updatedFiles=$(git status | awk '{print $2}' | grep -P "\..*$")
 
touch updates/update.txt
git status > updates/update.txt
 
for file in $updatedFiles
do
    cp --parents "$file" ./updates
    echo "copied $file to ./updates/$file"
done;
 
read -p "Press enter to exit"
mkdir updates and then run the bash script above. Files will be copied into updates directory, and we can manage it by date.

No comments:

Post a Comment