From 2a34e0264aa126bd7be2ccba5f61e5972567af14 Mon Sep 17 00:00:00 2001 From: guanjihuan Date: Mon, 6 Nov 2023 04:34:36 +0800 Subject: [PATCH] 0.1.16 --- PyPI/setup.cfg | 2 +- PyPI/src/guan.egg-info/PKG-INFO | 2 +- PyPI/src/guan/file_processing.py | 33 ++++++++++++++++++++++++-------- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 286bb89..28b9a64 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.15 +version = 0.1.16 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index c62c333..dc37975 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.1.15 +Version: 0.1.16 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/file_processing.py b/PyPI/src/guan/file_processing.py index 34be679..0530bb3 100644 --- a/PyPI/src/guan/file_processing.py +++ b/PyPI/src/guan/file_processing.py @@ -308,31 +308,48 @@ def find_repeated_file_with_same_filename(directory='./', ignored_directory_with return repeated_file # 统计各个子文件夹中的文件数量 -def count_file_in_sub_directory(directory='./', smaller_than_num=None): +def count_file_in_sub_directory(directory='./', smaller_than_num=None, sort=0): import os - from collections import Counter + import numpy as np dirs_list = [] for root, dirs, files in os.walk(directory): if dirs != []: for i0 in range(len(dirs)): dirs_list.append(root+'/'+dirs[i0]) + count_file_array = [] for sub_dir in dirs_list: file_list = [] for root, dirs, files in os.walk(sub_dir): for i0 in range(len(files)): file_list.append(files[i0]) count_file = len(file_list) - if smaller_than_num == None: - print(sub_dir) - print(count_file) - print() - else: - if count_file