Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

accelerate some deep scans and safer filter for "*~" backup files #1356

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions cleaners/deepscan.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@
<label>Backup files</label>
<description>Delete the backup files</description>
<warning>Inspect the preview for any files you want to keep.</warning>
<action command="delete" search="deep" regex="\.[Bb][Aa][Kk]$"/>
<action command="delete" search="deep" regex="[a-zA-Z]{1,4}~$"/>
<action command="delete" search="deep" regex="^[^\.](Bb][Aa][Kk]|.*[a-zA-Z0-9]~)$"/>
</option>
<option id="ds_store">
<label translate="false">.DS_Store</label>
Expand All @@ -50,17 +49,15 @@
<label translate="false">Thumbs.db</label>
<description>Delete the files</description>
<warning>This option is slow.</warning>
<action command="delete" search="deep" regex="^Thumbs\.db$"/>
<action command="delete" search="deep" regex="^Thumbs\.db:encryptable$"/>
<action command="delete" search="deep" regex="^Thumbs\.db(:encryptable)?$"/>
</option>
<option id="tmp">
<label>Temporary files</label>
<description>Delete the temporary files</description>
<warning>This option is slow.</warning>
<!-- http://support.microsoft.com/kb/211632 -->
<action command="delete" search="deep" regex="^~wr[a-z][0-9]{4}\.tmp$"/>
<!-- http://support.microsoft.com/kb/826810 -->
<action command="delete" search="deep" regex="^ppt[0-9]{4}\.tmp$"/>
<action command="delete" search="deep" regex="^(~wr[a-z]|ppt)[0-9]{4}\.tmp$"/>
</option>
<option id="vim_swap_user">
<label>VIM swap files under user profile</label>
Expand All @@ -79,7 +76,6 @@ times is small.

Be careful not to match files such as ~/.htpasswd
https://github.com/bleachbit/bleachbit/issues/683

-->
<action command="delete" search="deep" regex="^.*\.sw[nop]$"/>
</option>
Expand Down
2 changes: 1 addition & 1 deletion tests/TestDeepScan.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def test_DeepScan(self):
"""Unit test for class DeepScan. Preview real files."""
path = os.path.expanduser('~')
searches = {path: []}
for regex in ('^Makefile$', '~$', 'bak$', '^Thumbs.db$', '^Thumbs.db:encryptable$'):
for regex in ('^(Makefile|Thumbs.db(:encryptable)?|bak|~)$'):
searches[path].append(Search(command='delete', regex=regex))
ds = DeepScan(searches)
for cmd in ds.scan():
Expand Down