ubuntu delete the two files with the same name in the folder

for i in `awk 'a[$1]++' <(dir -l dir1 dir2 |awk '{print $NF}')`
do
rm -r dir1/$i
rm -r dir2/$i
done

For beginner-friendly briefly explain how this code is executed:
1. Create a new script file as jiaoben.sh vi
2. Paste the above code, dir1, dir2 converted to the desired path
3.chmod -x jiaoben.sh given executable permissions
4. ./jiaoben.sh execute the script file

Published 48 original articles · won praise 23 · views 1311

Guess you like

Origin blog.csdn.net/qq_37724465/article/details/104210511
Recommended