Skip to content
Open
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
7 changes: 4 additions & 3 deletions move_by_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
__version__ = "0.1"

try:
import re
import sys
import os
import shutil
Expand Down Expand Up @@ -107,10 +108,10 @@ def process(the_path, the_file):
for path, directories, files in os.walk(args.src):
for fil in files:
# ignore files without extension, can have the same name as the ext
file_ext = fil.split('.')[-1] if len(fil.split('.')) > 1 else None
file_ext = fil.split('.')[-1].lower() if len(fil.split('.')) > 1 else ''
# ignore dots in given extensions
extensions = [ext.replace('.', '') for ext in args.ext]
if file_ext in extensions:
extensions = [ext.replace('.', '').lower() for ext in args.ext]
if any(re.search(ext, file_ext) for ext in extensions):
count += process(path, fil)

opt = int("{0}{1}".format(int(args.rm), int(args.cp)), 2)
Expand Down