Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Удаление копий
- function deleteCopy {
- path=$1
- dir=$(dirname -- "$path")
- file=$(basename -- "$path")
- size=$(stat -c%s $path)
- let "size=$size/2"
- copy=$(find $dir -maxdepth 2 -mindepth 2 -size -${size}c -name $file )
- if [[ $copy ]]; then
- echo "delete : $copy"
- $(find $dir -maxdepth 2 -mindepth 2 -size -${size}c -name $file -delete)
- fi
- }
- #Поиск изображений в папке
- function processingImageInFolder {
- path2=$1
- #echo $path2
- mapfile -t images < <(find $path2 -maxdepth 1 -name '*.jpg' -type f )
- for image in ${images[@]}
- do
- #echo $image
- deleteCopy $image
- done
- }
- #Обход папок
- function processingFolder {
- path3=$1
- N=0
- while true
- do
- #echo $N
- mapfile -t folders < <(find $path3 -maxdepth $N -mindepth $N -type d )
- if [ ${#folders[@]} = 0 ]; then
- break
- fi
- for folder in ${folders[@]}
- do
- #echo $folder
- processingImageInFolder $folder
- done
- let "N=$N+1"
- done
- }
- IFS='\n'
- echo start
- processingFolder $1
- echo finish
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement