Skip to content

Commit

Permalink
mandatory arguments last and not first
Browse files Browse the repository at this point in the history
  • Loading branch information
niradar committed Jun 17, 2024
1 parent c49d86d commit 1f1d055
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,30 +50,30 @@ python df_finder3.py --scan_dir <scan_folder> --reference_dir <reference_folder>

#### Simple usage:
```sh
python df_finder3.py --scan_dir /path/to/scan_dir --reference_dir /path/to/reference_dir --move_to /path/to/move_to --run
python df_finder3.py --run --scan_dir /path/to/scan_dir --reference_dir /path/to/reference_dir --move_to /path/to/move_to
```
#### Most common usage:
Ignore differences in modification dates, copy the file to all target folders if found in multiple folders, and run without test mode:
```sh
python df_finder3.py --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to --run --ignore_diff mdate --copy_to_all
python df_finder3.py --run --ignore_diff mdate --copy_to_all --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to
```

#### Using Whitelist and Blacklist
```sh
python df_finder3.py --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to --whitelist_ext jpg,png --run
python df_finder3.py --whitelist_ext jpg,png --run --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to
```

```sh
python df_finder3.py --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to --blacklist_ext tmp,log --run
python df_finder3.py --blacklist_ext tmp,log --run --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to
```

#### Filtering by File Size
```sh
python df_finder3.py --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to --min_size 1MB --max_size 100MB --run
python df_finder3.py --min_size 1MB --max_size 100MB --run --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to
```
#### Ignore none of the differences
```sh
python df_finder3.py --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to --ignore_diff none --run
python df_finder3.py --ignore_diff none --run --s /path/to/scan_dir --r /path/to/reference_dir --to /path/to/move_to
```

## Installation
Expand Down
15 changes: 7 additions & 8 deletions duplicate_files_in_folders/utils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import argparse
import logging
import os
import sys
import time
from typing import List
from argparse import Namespace

from duplicate_files_in_folders.file_manager import FileManager
Expand Down Expand Up @@ -51,12 +49,6 @@ def initialize_arguments(cust_args=None):
parser = argparse.ArgumentParser(
description="Identify duplicate files between scan and reference folders, "
"move duplicates from scan folder to a separate folder.")
parser.add_argument('--scan_dir', '--scan', '--s', dest='scan_dir', required=True,
help='Path - folder to scan for duplicates.')
parser.add_argument('--reference_dir', '--reference', '--r', required=True,
help='Path - folder to compare with scan_dir.')
parser.add_argument('--move_to', '--to', required=True, type=str,
help='Path - duplicate files from scan_dir will be moved to this folder.')
parser.add_argument('--run', action='store_true', help='Run without test mode. Default is test mode.')
parser.add_argument('--ignore_diff', type=str, help='Comma-separated list of differences to ignore: '
'mdate, filename, none. Default is ignore mdate.',
Expand All @@ -83,6 +75,13 @@ def initialize_arguments(cust_args=None):
parser.add_argument('--action', type=str, choices=['move_duplicates', 'create_csv'],
help='Action to perform: move_duplicates, create_csv', default='move_duplicates')

parser.add_argument('--scan_dir', '--scan', '--s', dest='scan_dir', required=True,
help='Path - folder to scan for duplicates.')
parser.add_argument('--reference_dir', '--reference', '--r', required=True,
help='Path - folder to compare with scan_dir.')
parser.add_argument('--move_to', '--to', required=True, type=str,
help='Path - duplicate files from scan_dir will be moved to this folder.')

args = parser.parse_args(cust_args if cust_args else None)
return args

Expand Down

0 comments on commit 1f1d055

Please sign in to comment.