2

[Bash] Find Redundant Files Saved by Chrome

 2 years ago
source link: https://siongui.github.io/2016/05/23/bash-find-redundant-files-saved-by-chrome/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Bash] Find Redundant Files Saved by Chrome

May 23, 2016

Find redundant files saved by Chrome browser via Bash script.

chrome.sh | repository | view raw
#!/bin/bash

# $1 is the directory in which files to be processed
IFS=$'\n'
for path in $(find $1 -type f)
do
  filename=$(basename "$path")
  filenameWithoutExt=${filename%.*}
  if [[ ${filenameWithoutExt} =~ \ \([0-9]+\)$ ]]; then
    echo ${path}
    #rm ${path}
  fi
done

Tested on: Ubuntu Linux 16.04, bash 4.3-14ubuntu1.


References:

[1][Python] Find Redundant Files Saved by Chrome[2][Golang] Find Redundant Files Saved by Chrome[5]bash regex match - Google search

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK