Skip to content

Commit

Permalink
Add command-line option to wipe any paths
Browse files Browse the repository at this point in the history
  • Loading branch information
az0 committed Jan 23, 2019
1 parent 2c05f3f commit a35103a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions bleachbit/CLI.py
Expand Up @@ -162,6 +162,8 @@ def process_cmd_line():
if 'nt' == os.name:
parser.add_option("--update-winapp2", action="store_true",
help=_("update winapp2.ini, if a new version is available"))
parser.add_option("-w", "--wipe-free-space", action="store_true",
help=_("wipe free space in the given paths"))
parser.add_option("-v", "--version", action="store_true",
help=_("output version information and exit"))
parser.add_option('-o', '--overwrite', action='store_true',
Expand Down Expand Up @@ -195,6 +197,22 @@ def process_cmd_line():
from bleachbit.CleanerML import create_pot
create_pot()
sys.exit(0)
if options.wipe_free_space:
if len(args) < 1:
logger.error('No directories given for --wipe-free-space')
sys.exit(1)
for wipe_path in args:
if not os.path.isdir(wipe_path):
logger.error(
'Path to wipe must be an existing directory: %s', wipe_path)
sys.exit(1)
logger.info('Wiping free space can take a long time.')
for wipe_path in args:
logger.info('Wiping free space in path: %s', wipe_path)
import bleachbit.FileUtilities
for ret in bleachbit.FileUtilities.wipe_path(wipe_path):
pass
sys.exit(0)
if options.preview or options.clean:
operations = args_to_operations(args, options.preset)
if not operations:
Expand Down

0 comments on commit a35103a

Please sign in to comment.