{"id":324780,"date":"2021-06-11T15:00:26","date_gmt":"2021-06-11T15:00:26","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=324780"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=324780","title":{"rendered":"\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u044b \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/2fc\/926\/c87\/2fc926c87135af005542788c33d65220.png\" width=\"1920\" height=\"1080\"><figcaption><\/figcaption><\/figure>\n<p>\u0428\u0442\u043e\u0448. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0443 \u043c\u043d\u043e\u0433\u0438\u0445 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0430\u0441\u044c \u043a\u0443\u0447\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0442\u043e\u0440\u043e\u0432, \u0430\u0440\u0445\u0438\u0432\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u0418 \u0432\u043e\u0442 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437 \u044d\u0442\u043e\u0439 \u043a\u0443\u0447\u0438 \u044d\u043a\u0441\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0444\u0430\u0439\u043b. \u0412\u043e\u0442 \u044f \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043f\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 Python? <\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c \u043a\u043e\u0434<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c <strong>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c os<\/strong> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b.<\/p>\n<pre><code class=\"python\">import os<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u043f\u0443\u0442\u0438 \u043f\u0430\u043f\u043a\u0438 \u0438\u043b\u0438 \u0434\u0438\u0441\u043a\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b. \u0412 \u043c\u043e\u0438\u0445 \u043b\u044e\u0431\u0438\u043c\u044b\u0445 <abbr title=\"Windows\">\u043e\u043a\u043e\u0448\u0435\u0447\u043a\u0430\u0445<\/abbr> \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 backslash, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 Python \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043b\u0438\u0431\u043e \u043f\u0438\u0448\u0435\u043c 2 \u0431\u044d\u043a\u0441\u043b\u044d\u0448\u0430, \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0431\u0443\u043a\u0432\u0443 r, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044f \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">main_path = 'd:\\\\down' # main_path = r'd:\\down<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <strong>os.mkdir()<\/strong><\/p>\n<pre><code class=\"python\">os.mkdir(main_path + '\\\\aboba')<\/code><\/pre>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u0430\u043f\u043e\u043a<\/h2>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u043f\u043e\u043a \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <strong>os.path.exists().<\/strong><\/p>\n<pre><code class=\"python\"># also creates folders from dictionary keys def create_folders_from_list(folder_path, folder_names):     for folder in folder_names:         if not os.path.exists(f'{folder_path}\\\\{folder}'):             os.mkdir(f'{folder_path}\\\\{folder}')<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c extensions. \u041a\u043b\u044e\u0447\u0438 &#8212; \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043f\u043e\u043a. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f &#8212; \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438.<\/p>\n<pre><code class=\"python\"># key names will be folder names! extensions = {      'video': ['mp4', 'mov', 'avi', 'mkv', 'wmv', '3gp', '3g2', 'mpg', 'mpeg', 'm4v',                'h264', 'flv', 'rm', 'swf', 'vob'],      'data': ['sql', 'sqlite', 'sqlite3', 'csv', 'dat', 'db', 'log', 'mdb', 'sav',               'tar', 'xml'],      'audio': ['mp3', 'wav', 'ogg', 'flac', 'aif', 'mid', 'midi', 'mpa', 'wma', 'wpl',               'cda'],      'image': ['jpg', 'png', 'bmp', 'ai', 'psd', 'ico', 'jpeg', 'ps', 'svg', 'tif',                'tiff'],      'archive': ['zip', 'rar', '7z', 'z', 'gz', 'rpm', 'arj', 'pkg', 'deb'],      'text': ['pdf', 'txt', 'doc', 'docx', 'rtf', 'tex', 'wpd', 'odt'],      '3d': ['stl', 'obj', 'fbx', 'dae', '3ds', 'iges', 'step'],      'presentation': ['pptx', 'ppt', 'pps', 'key', 'odp'],      'spreadsheet': ['xlsx', 'xls', 'xlsm', 'ods'],      'font': ['otf', 'ttf', 'fon', 'fnt'],      'gif': ['gif'],      'exe': ['exe'],      'bat': ['bat'],      'apk': ['apk'] }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>create_folders_from_list()<\/strong> \u043d\u043e\u0432\u043e\u0438\u0441\u043f\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u041f\u0430\u043f\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0443\u0442\u0441\u044f \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043a\u043b\u044e\u0447\u0435\u0439.<\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a \u0438 \u0444\u0430\u0439\u043b\u043e\u0432<\/h2>\n<p>\u041f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0435\u0439 \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <strong>os.scandir() <\/strong>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u043c.<\/p>\n<pre><code class=\"python\">def get_subfolder_paths(folder_path) -&gt; list:     subfolder_paths = [f.path for f in os.scandir(folder_path) if f.is_dir()]      return subfolder_paths<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043a\u0430\u043a \u0441\u043d\u0438\u043f\u043f\u0435\u0442 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0430.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0443\u0442\u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a, \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e \u0431\u044d\u043a\u0441\u043b\u044d\u0448\u0430\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442.<\/p>\n<pre><code class=\"python\">def get_subfolder_names(folder_path) -&gt; list:     subfolder_paths = get_subfolder_paths(folder_path)     subfolder_names = [f.split('\\\\')[-1] for f in subfolder_paths]      return subfolder_names<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u0443\u0442\u0438 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u0430\u043f\u043a\u0435, \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>get_subfolder_paths()<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <strong>not.<\/strong><\/p>\n<pre><code class=\"python\">def get_file_paths(folder_path) -&gt; list:     file_paths = [f.path for f in os.scandir(folder_path) if not f.is_dir()]      return file_paths<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u044f \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d \u0444\u0430\u0439\u043b\u043e\u0432. <\/p>\n<pre><code class=\"python\">def get_file_names(folder_path) -&gt; list:     file_paths = [f.path for f in os.scandir(folder_path) if not f.is_dir()]     file_names = [f.split('\\\\')[-1] for f in file_paths]      return file_names<\/code><\/pre>\n<h2>\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u044b<\/h2>\n<p>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>file_paths<\/strong>. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>ext_list<\/strong> \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044f <strong>extensions.items(). <\/strong>\u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430, \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e &#8212; \u044d\u0442\u043e \u043a\u043b\u044e\u0447 \u0438\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0438.  <\/p>\n<pre><code class=\"python\">def sort_files(folder_path):     file_paths = get_file_paths(folder_path)     ext_list = list(extensions.items())<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0446\u0438\u043a\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435. \u0412\u044b\u0442\u0430\u0449\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0438 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"python\">for file_path in file_paths:   extension = file_path.split('.')[-1]   file_name = file_path.split('\\\\')[-1]<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0446\u0438\u043a\u043b \u0432\u043d\u0443\u0442\u0440\u0438. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">for dict_key_int in range(len(ext_list)):   if extension in ext_list[dict_key_int][1]:     print(f'Moving {file_name} in {ext_list[dict_key_int][0]} folder\\n')     os.rename(file_path, f'{main_path}\\\\{ext_list[dict_key_int][0]}\\\\{file_name}')<\/code><\/pre>\n<p>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0438 \u0444\u0430\u0439\u043b\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <strong>os.rename(&#171;\u041f\u0443\u0442\u044c \u0444\u0430\u0439\u043b\u0430 \u0441\u0435\u0439\u0447\u0430\u0441&#187;, &#171;\u0411\u0443\u0434\u0443\u0449\u0438\u0439 \u043f\u0443\u0442\u044c \u0444\u0430\u0439\u043b\u0430&#187;)<\/strong><\/p>\n<h4>\u0413\u043e\u0442\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432:<\/h4>\n<pre><code class=\"python\">def sort_files(folder_path):     file_paths = get_file_paths(folder_path)     ext_list = list(extensions.items())      for file_path in file_paths:         extension = file_path.split('.')[-1]         file_name = file_path.split('\\\\')[-1]          for dict_key_int in range(len(ext_list)):             if extension in ext_list[dict_key_int][1]:                 print(f'Moving {file_name} in {ext_list[dict_key_int][0]} folder\\n')                 os.rename(file_path, f'{main_path}\\\\{ext_list[dict_key_int][0]}\\\\{file_name}')<\/code><\/pre>\n<h2>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0435 \u043f\u0430\u043f\u043a\u0438<\/h2>\n<p>\u041e\u0441\u0442\u0430\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0442\u0440\u0438\u0445 &#8212; \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u044b\u0445 \u043f\u0430\u043f\u043e\u043a. \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043a\u0430\u043a\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <strong>os.listdir(&#171;folder_path&#187;) <\/strong>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0438. \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0437\u043d\u0430\u0447\u0438\u0442 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>os.rmdir(&#171;folder_path&#187;)<\/strong><\/p>\n<pre><code class=\"python\">def remove_empty_folders(folder_path):     subfolder_paths = get_subfolder_paths(folder_path)      for p in subfolder_paths:         if not os.listdir(p):             print('Deleting empty folder:', p.split('\\\\')[-1], '\\n')             os.rmdir(p)<\/code><\/pre>\n<h2>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h2>\n<pre><code class=\"python\">import os  main_path = 'd:\\\\down'  # key names will be folder names! extensions = {      'video': ['mp4', 'mov', 'avi', 'mkv', 'wmv', '3gp', '3g2', 'mpg', 'mpeg', 'm4v', 'h264', 'flv',               'rm', 'swf', 'vob'],      'data': ['sql', 'sqlite', 'sqlite3', 'csv', 'dat', 'db', 'log', 'mdb', 'sav', 'tar', 'xml'],      'audio': ['mp3', 'wav', 'ogg', 'flac', 'aif', 'mid', 'midi', 'mpa', 'wma', 'wpl', 'cda'],      'image': ['jpg', 'png', 'bmp', 'ai', 'psd', 'ico', 'jpeg', 'ps', 'svg', 'tif', 'tiff'],      'archive': ['zip', 'rar', '7z', 'z', 'gz', 'rpm', 'arj', 'pkg', 'deb'],      'text': ['pdf', 'txt', 'doc', 'docx', 'rtf', 'tex', 'wpd', 'odt'],      '3d': ['stl', 'obj', 'fbx', 'dae', '3ds', 'iges', 'step'],      'presentation': ['pptx', 'ppt', 'pps', 'key', 'odp'],      'spreadsheet': ['xlsx', 'xls', 'xlsm', 'ods'],      'font': ['otf', 'ttf', 'fon', 'fnt'],      'gif': ['gif'],      'exe': ['exe'],      'bat': ['bat'],      'apk': ['apk'] }   # also creates folders from dictionary keys def create_folders_from_list(folder_path, folder_names):     for folder in folder_names:         if not os.path.exists(f'{folder_path}\\\\{folder}'):             os.mkdir(f'{folder_path}\\\\{folder}')   def get_subfolder_paths(folder_path) -&gt; list:     subfolder_paths = [f.path for f in os.scandir(folder_path) if f.is_dir()]      return subfolder_paths   def get_file_paths(folder_path) -&gt; list:     file_paths = [f.path for f in os.scandir(folder_path) if not f.is_dir()]      return file_paths   def sort_files(folder_path):     file_paths = get_file_paths(folder_path)     ext_list = list(extensions.items())      for file_path in file_paths:         extension = file_path.split('.')[-1]         file_name = file_path.split('\\\\')[-1]          for dict_key_int in range(len(ext_list)):             if extension in ext_list[dict_key_int][1]:                 print(f'Moving {file_name} in {ext_list[dict_key_int][0]} folder\\n')                 os.rename(file_path, f'{main_path}\\\\{ext_list[dict_key_int][0]}\\\\{file_name}')   def remove_empty_folders(folder_path):     subfolder_paths = get_subfolder_paths(folder_path)      for p in subfolder_paths:         if not os.listdir(p):             print('Deleting empty folder:', p.split('\\\\')[-1], '\\n')             os.rmdir(p)   if __name__ == \"__main__\":     create_folders_from_list(main_path, extensions)     sort_files(main_path)     remove_empty_folders(main_path)<\/code><\/pre>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u043d\u0443\u0436\u0434\u044b<\/h2>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0438\u0431\u043a\u0430\u044f, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0435 \u043f\u043e\u0434 \u0441\u0435\u0431\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e-\u043b\u0438\u0448\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c extensions.<\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0438\u0434\u0435\u043e \u043d\u0430 \u0441\u0432\u043e\u0439 <a href=\"https:\/\/www.youtube.com\/channel\/UCWNlTmzBisvogxKQMV-lhRw\" rel=\"noopener noreferrer nofollow\">YouTube \u043a\u0430\u043d\u0430\u043b<\/a> \u044f \u0441\u043e\u0437\u0434\u0430\u044e \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u043f\u0430\u043f\u043a\u0438 \u0434\u043b\u044f \u0444\u0443\u0442\u0430\u0436\u0435\u0439, \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a, \u0437\u0432\u0443\u043a\u0430, mkv \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 mp4 (premiere \u043d\u0435 \u043b\u044e\u0431\u0438\u0442 mkv) \u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c.<\/p>\n<pre><code class=\"python\">main_folder = 'f:\\\\shtosh python\\\\new video'  # key names will be folder names! extensions = {      'img': ['jpg', 'png', 'bmp', 'gif', 'ico', 'jpeg'],      'audio': ['mp3', 'wav'],      'footage': ['mp4', 'mov', 'avi'],      'mkv': ['mkv'],      'prj': [] }<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u044f \u043c\u043e\u0433\u0443 \u043d\u0430\u043a\u0438\u0434\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043c\u043e\u043d\u0442\u0430\u0436\u0430 \u0432 \u043e\u0434\u043d\u0443 \u043f\u0430\u043f\u043a\u0443, \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u043b\u0435\u0433\u043a\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0432 premiere pro.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0428\u0442\u043e\u0448. \u041a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 <a href=\"https:\/\/github.com\/lesskop\/file-sorter\" rel=\"noopener noreferrer nofollow\">GitHub.<\/a> \u0411\u0435\u0440\u0438\u0442\u0435, \u0438\u0437\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u043f\u043e\u0434 \u0441\u0435\u0431\u044f, \u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043b\u044e\u0431\u043e\u043c\u0443 \u0444\u0438\u0434\u0431\u0435\u043a\u0443.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/562362\/\"> https:\/\/habr.com\/ru\/post\/562362\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0428\u0442\u043e\u0448. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0443 \u043c\u043d\u043e\u0433\u0438\u0445 \u0432 \u043f\u0430\u043f\u043a\u0435 \u0437\u0430\u0433\u0440\u0443\u0437\u043e\u043a \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0430\u0441\u044c \u043a\u0443\u0447\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0430\u043b\u043b\u044f\u0442\u043e\u0440\u043e\u0432, \u0430\u0440\u0445\u0438\u0432\u043e\u0432 \u0438 \u043f\u0440\u043e\u0447\u0438\u0445 \u0444\u0430\u0439\u043b\u043e\u0432. \u0418 \u0432\u043e\u0442 \u043d\u0430\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u0438\u0437 \u044d\u0442\u043e\u0439 \u043a\u0443\u0447\u0438 \u044d\u043a\u0441\u043a\u0440\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0444\u0430\u0439\u043b. \u0412\u043e\u0442 \u044f \u0438 \u043f\u043e\u0434\u0443\u043c\u0430\u043b, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430 \u043f\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f\u043c \u0444\u0430\u0439\u043b\u043e\u0432 \u043d\u0430 Python? <\/p>\n<h2>\u041f\u0438\u0448\u0435\u043c \u043a\u043e\u0434<\/h2>\n<p>\u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c <strong>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c os<\/strong> \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u043e\u0439. \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0438 \u0438 \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b.<\/p>\n<pre><code class=\"python\">import os<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0434\u043b\u044f \u043f\u0443\u0442\u0438 \u043f\u0430\u043f\u043a\u0438 \u0438\u043b\u0438 \u0434\u0438\u0441\u043a\u0430, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0444\u0430\u0439\u043b\u044b. \u0412 \u043c\u043e\u0438\u0445 \u043b\u044e\u0431\u0438\u043c\u044b\u0445 <abbr title=\"Windows\">\u043e\u043a\u043e\u0448\u0435\u0447\u043a\u0430\u0445<\/abbr> \u043f\u0443\u0442\u044c \u043a \u0444\u0430\u0439\u043b\u0443 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 backslash, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 Python \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u043c \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043b\u0438\u0431\u043e \u043f\u0438\u0448\u0435\u043c 2 \u0431\u044d\u043a\u0441\u043b\u044d\u0448\u0430, \u043b\u0438\u0431\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u0434 \u0441\u0442\u0440\u043e\u043a\u043e\u0439 \u0431\u0443\u043a\u0432\u0443 r, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043f\u043e\u0434\u0430\u0432\u043b\u044f\u044f \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.<\/p>\n<pre><code class=\"python\">main_path = 'd:\\\\down' # main_path = r'd:\\down<\/code><\/pre>\n<p>\u0427\u0442\u043e\u0431\u044b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0430\u043f\u043a\u0443, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043c\u0435\u0442\u043e\u0434 <strong>os.mkdir()<\/strong><\/p>\n<pre><code class=\"python\">os.mkdir(main_path + '\\\\aboba')<\/code><\/pre>\n<h2>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u043d\u043e\u0433\u043e \u043f\u0430\u043f\u043e\u043a<\/h2>\n<p>\u041d\u0430\u043f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u0430\u043f\u043e\u043a \u0438\u0437 \u0441\u043f\u0438\u0441\u043a\u0430 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430 <strong>os.path.exists().<\/strong><\/p>\n<pre><code class=\"python\"># also creates folders from dictionary keys def create_folders_from_list(folder_path, folder_names):     for folder in folder_names:         if not os.path.exists(f'{folder_path}\\\\{folder}'):             os.mkdir(f'{folder_path}\\\\{folder}')<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u043b\u043e\u0432\u0430\u0440\u044c extensions. \u041a\u043b\u044e\u0447\u0438 &#8212; \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u044f \u043f\u0430\u043f\u043e\u043a. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f &#8212; \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0438.<\/p>\n<pre><code class=\"python\"># key names will be folder names! extensions = {      'video': ['mp4', 'mov', 'avi', 'mkv', 'wmv', '3gp', '3g2', 'mpg', 'mpeg', 'm4v',                'h264', 'flv', 'rm', 'swf', 'vob'],      'data': ['sql', 'sqlite', 'sqlite3', 'csv', 'dat', 'db', 'log', 'mdb', 'sav',               'tar', 'xml'],      'audio': ['mp3', 'wav', 'ogg', 'flac', 'aif', 'mid', 'midi', 'mpa', 'wma', 'wpl',               'cda'],      'image': ['jpg', 'png', 'bmp', 'ai', 'psd', 'ico', 'jpeg', 'ps', 'svg', 'tif',                'tiff'],      'archive': ['zip', 'rar', '7z', 'z', 'gz', 'rpm', 'arj', 'pkg', 'deb'],      'text': ['pdf', 'txt', 'doc', 'docx', 'rtf', 'tex', 'wpd', 'odt'],      '3d': ['stl', 'obj', 'fbx', 'dae', '3ds', 'iges', 'step'],      'presentation': ['pptx', 'ppt', 'pps', 'key', 'odp'],      'spreadsheet': ['xlsx', 'xls', 'xlsm', 'ods'],      'font': ['otf', 'ttf', 'fon', 'fnt'],      'gif': ['gif'],      'exe': ['exe'],      'bat': ['bat'],      'apk': ['apk'] }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>create_folders_from_list()<\/strong> \u043d\u043e\u0432\u043e\u0438\u0441\u043f\u0435\u0447\u0435\u043d\u043d\u044b\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c. \u041f\u0430\u043f\u043a\u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0443\u0442\u0441\u044f \u0438\u0437 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0439 \u043a\u043b\u044e\u0447\u0435\u0439.<\/p>\n<h2>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a \u0438 \u0444\u0430\u0439\u043b\u043e\u0432<\/h2>\n<p>\u041f\u0438\u0448\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0435\u0439 \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u0432 \u043c\u0435\u0442\u043e\u0434\u0435 <strong>os.scandir() <\/strong>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u043e\u043d \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u043e\u043c.<\/p>\n<pre><code class=\"python\">def get_subfolder_paths(folder_path) -&gt; list:     subfolder_paths = [f.path for f in os.scandir(folder_path) if f.is_dir()]      return subfolder_paths<\/code><\/pre>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u043c \u043d\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0434\u0430\u043b\u044c\u0448\u0435. \u041f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u0438 \u043d\u0435\u0442? \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435, \u043a\u0430\u043a \u0441\u043d\u0438\u043f\u043f\u0435\u0442 \u0434\u043b\u044f \u0434\u0430\u043b\u044c\u043d\u0435\u0439\u0448\u0438\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u0430.<\/p>\n<p>\u041d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u043f\u0443\u0442\u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a, \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u043e \u0431\u044d\u043a\u0441\u043b\u044d\u0448\u0430\u043c \u0441\u0442\u0440\u043e\u043a\u0443 \u0438 \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442.<\/p>\n<pre><code class=\"python\">def get_subfolder_names(folder_path) -&gt; list:     subfolder_paths = get_subfolder_paths(folder_path)     subfolder_names = [f.split('\\\\')[-1] for f in subfolder_paths]      return subfolder_names<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043f\u0443\u0442\u0438 \u0432\u0441\u0435\u0445 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u0430\u043f\u043a\u0435, \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <strong>get_subfolder_paths()<\/strong> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <strong>not.<\/strong><\/p>\n<pre><code class=\"python\">def get_file_paths(folder_path) -&gt; list:     file_paths = [f.path for f in os.scandir(folder_path) if not f.is_dir()]      return file_paths<\/code><\/pre>\n<p>\u0414\u043b\u044f \u043f\u043e\u043b\u043d\u043e\u0433\u043e \u0441\u0447\u0430\u0441\u0442\u044c\u044f \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f \u0438\u043c\u0435\u043d \u0444\u0430\u0439\u043b\u043e\u0432. <\/p>\n<pre><code class=\"python\">def get_file_names(folder_path) -&gt; list:     file_paths = [f.path for f in os.scandir(folder_path) if not f.is_dir()]     file_names = [f.split('\\\\')[-1] for f in file_paths]      return file_names<\/code><\/pre>\n<h2>\u0421\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0444\u0430\u0439\u043b\u044b<\/h2>\n<p>\u041f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u0444\u0430\u0439\u043b\u043e\u0432 \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>file_paths<\/strong>. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <strong>ext_list<\/strong> \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u043c \u043c\u0435\u0442\u043e\u0434\u0430 \u0441\u043b\u043e\u0432\u0430\u0440\u044f <strong>extensions.items(). <\/strong>\u041e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u043f\u0438\u0441\u043a\u0443 \u043f\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u0443 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043d\u0430\u043c \u043f\u0430\u0440\u0443 \u043a\u043b\u044e\u0447-\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0441\u043f\u0438\u0441\u043a\u0430, \u043f\u0435\u0440\u0432\u044b\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e &#8212; \u044d\u0442\u043e \u043a\u043b\u044e\u0447 \u0438\u043b\u0438 \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043f\u043a\u0438 \u0432 \u043d\u0430\u0448\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u044d\u043b\u0435\u043c\u0435\u043d\u0442 &#8212; \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u044d\u0442\u043e\u0439 \u043f\u0430\u043f\u043a\u0438.  <\/p>\n<pre><code class=\"python\">def sort_files(folder_path):     file_paths = get_file_paths(folder_path)     ext_list = list(extensions.items())<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0446\u0438\u043a\u043b \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0442\u0438 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435. \u0412\u044b\u0442\u0430\u0449\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0438 \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430.<\/p>\n<pre><code class=\"python\">for file_path in file_paths:   extension = file_path.split('.')[-1]   file_name = file_path.split('\\\\')[-1]<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0446\u0438\u043a\u043b \u0432\u043d\u0443\u0442\u0440\u0438. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043a\u043b\u044e\u0447\u0430 \u0432 \u0441\u043b\u043e\u0432\u0430\u0440\u0435 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u0444\u0430\u0439\u043b\u0430 \u0432 \u0441\u043f\u0438\u0441\u043a\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0439. \u0415\u0441\u043b\u0438 \u0435\u0441\u0442\u044c, \u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u0449\u0430\u0435\u043c \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">for dict_key_int in range(len(ext_list)):   if extension in ext_list[dict_key_int][1]:     print(f'Moving {file_name} in {ext_list[dict_key_int][0]} folder\\n')     os.rename(file_path, f'{main_path}\\\\{ext_list[dict_key_int][0]}\\\\{file_name}')<\/code><\/pre>\n<p>\u0421\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0443\u0442\u0438 \u0444\u0430\u0439\u043b\u0430 \u043c\u0435\u0442\u043e\u0434\u043e\u043c <strong>os.rename(&#171;\u041f\u0443\u0442\u044c \u0444\u0430\u0439\u043b\u0430 \u0441\u0435\u0439\u0447\u0430\u0441&#187;, &#171;\u0411\u0443\u0434\u0443\u0449\u0438\u0439 \u043f\u0443\u0442\u044c \u0444\u0430\u0439\u043b\u0430&#187;)<\/strong><\/p>\n<h4>\u0413\u043e\u0442\u043e\u0432\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0444\u0430\u0439\u043b\u043e\u0432:<\/h4>\n<pre><code class=\"python\">def sort_files(folder_path):     file_paths = get_file_paths(folder_path)     ext_list = list(extensions.items())      for file_path in file_paths:         extension = file_path.split('.')[-1]         file_name = file_path.split('\\\\')[-1]          for dict_key_int in range(len(ext_list)):             if extension in ext_list[dict_key_int][1]:                 print(f'Moving {file_name} in {ext_list[dict_key_int][0]} folder\\n')                 os.rename(file_path, f'{main_path}\\\\{ext_list[dict_key_int][0]}\\\\{file_name}')<\/code><\/pre>\n<h2>\u0423\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0443\u0441\u0442\u044b\u0435 \u043f\u0430\u043f\u043a\u0438<\/h2>\n<p>\u041e\u0441\u0442\u0430\u043b\u0441\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0448\u0442\u0440\u0438\u0445 &#8212; \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u0435 \u043f\u0443\u0441\u0442\u044b\u0445 \u043f\u0430\u043f\u043e\u043a. \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u044e. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u0443\u0442\u0438 \u043f\u043e\u0434\u043f\u0430\u043f\u043e\u043a. \u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043a\u0430\u043a\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 <strong>os.listdir(&#171;folder_path&#187;) <\/strong>\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043e\u0434\u043f\u0430\u043f\u043a\u0438. \u0415\u0441\u043b\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043f\u0443\u0441\u0442\u043e\u0439 \u0441\u043f\u0438\u0441\u043e\u043a, \u0437\u043d\u0430\u0447\u0438\u0442 \u0443\u0434\u0430\u043b\u044f\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <strong>os.rmdir(&#171;folder_path&#187;)<\/strong><\/p>\n<pre><code class=\"python\">def remove_empty_folders(folder_path):     subfolder_paths = get_subfolder_paths(folder_path)      for p in subfolder_paths:         if not os.listdir(p):             print('Deleting empty folder:', p.split('\\\\')[-1], '\\n')             os.rmdir(p)<\/code><\/pre>\n<h2>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h2>\n<pre><code class=\"python\">import os  main_path = 'd:\\\\down'  # key names will be folder names! extensions = {      'video': ['mp4', 'mov', 'avi', 'mkv', 'wmv', '3gp', '3g2', 'mpg', 'mpeg', 'm4v', 'h264', 'flv',               'rm', 'swf', 'vob'],      'data': ['sql', 'sqlite', 'sqlite3', 'csv', 'dat', 'db', 'log', 'mdb', 'sav', 'tar', 'xml'],      'audio': ['mp3', 'wav', 'ogg', 'flac', 'aif', 'mid', 'midi', 'mpa', 'wma', 'wpl', 'cda'],      'image': ['jpg', 'png', 'bmp', 'ai', 'psd', 'ico', 'jpeg', 'ps', 'svg', 'tif', 'tiff'],      'archive': ['zip', 'rar', '7z', 'z', 'gz', 'rpm', 'arj', 'pkg', 'deb'],      'text': ['pdf', 'txt', 'doc', 'docx', 'rtf', 'tex', 'wpd', 'odt'],      '3d': ['stl', 'obj', 'fbx', 'dae', '3ds', 'iges', 'step'],      'presentation': ['pptx', 'ppt', 'pps', 'key', 'odp'],      'spreadsheet': ['xlsx', 'xls', 'xlsm', 'ods'],      'font': ['otf', 'ttf', 'fon', 'fnt'],      'gif': ['gif'],      'exe': ['exe'],      'bat': ['bat'],      'apk': ['apk'] }   # also creates folders from dictionary keys def create_folders_from_list(folder_path, folder_names):     for folder in folder_names:         if not os.path.exists(f'{folder_path}\\\\{folder}'):             os.mkdir(f'{folder_path}\\\\{folder}')   def get_subfolder_paths(folder_path) -&gt; list:     subfolder_paths = [f.path for f in os.scandir(folder_path) if f.is_dir()]      return subfolder_paths   def get_file_paths(folder_path) -&gt; list:     file_paths = [f.path for f in os.scandir(folder_path) if not f.is_dir()]      return file_paths   def sort_files(folder_path):     file_paths = get_file_paths(folder_path)     ext_list = list(extensions.items())      for file_path in file_paths:         extension = file_path.split('.')[-1]         file_name = file_path.split('\\\\')[-1]          for dict_key_int in range(len(ext_list)):             if extension in ext_list[dict_key_int][1]:                 print(f'Moving {file_name} in {ext_list[dict_key_int][0]} folder\\n')                 os.rename(file_path, f'{main_path}\\\\{ext_list[dict_key_int][0]}\\\\{file_name}')   def remove_empty_folders(folder_path):     subfolder_paths = get_subfolder_paths(folder_path)      for p in subfolder_paths:         if not os.listdir(p):             print('Deleting empty folder:', p.split('\\\\')[-1], '\\n')             os.rmdir(p)   if __name__ == \"__main__\":     create_folders_from_list(main_path, extensions)     sort_files(main_path)     remove_empty_folders(main_path)<\/code><\/pre>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043f\u043e\u0434 \u0441\u0432\u043e\u0438 \u043d\u0443\u0436\u0434\u044b<\/h2>\n<p>\u041a\u0430\u043a \u0432\u044b \u0443\u0436\u0435 \u043c\u043e\u0433\u043b\u0438 \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0433\u0438\u0431\u043a\u0430\u044f, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0435\u0435 \u043f\u043e\u0434 \u0441\u0435\u0431\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e-\u043b\u0438\u0448\u044c \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c extensions.<\/p>\n<p>\u041f\u0440\u0438\u0432\u0435\u0434\u0443 \u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0432\u0438\u0434\u0435\u043e \u043d\u0430 \u0441\u0432\u043e\u0439 <a href=\"https:\/\/www.youtube.com\/channel\/UCWNlTmzBisvogxKQMV-lhRw\" rel=\"noopener noreferrer nofollow\">YouTube \u043a\u0430\u043d\u0430\u043b<\/a> \u044f \u0441\u043e\u0437\u0434\u0430\u044e \u043a\u0430\u0442\u0430\u043b\u043e\u0433, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0435\u0441\u0442\u044c \u043f\u0430\u043f\u043a\u0438 \u0434\u043b\u044f \u0444\u0443\u0442\u0430\u0436\u0435\u0439, \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a, \u0437\u0432\u0443\u043a\u0430, mkv \u0444\u0430\u0439\u043b\u043e\u0432 \u0434\u043b\u044f \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0432 mp4 (premiere \u043d\u0435 \u043b\u044e\u0431\u0438\u0442 mkv) \u0438 \u0441\u0430\u043c\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0441\u043b\u043e\u0432\u0430\u0440\u044c.<\/p>\n<pre><code class=\"python\">main_folder = 'f:\\\\shtosh python\\\\new video'  # key names will be folder names! extensions = {      'img': ['jpg', 'png', 'bmp', 'gif', 'ico', 'jpeg'],      'audio': ['mp3', 'wav'],      'footage': ['mp4', 'mov', 'avi'],      'mkv': ['mkv'],      'prj': [] }<\/code><\/pre>\n<p>\u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0430 \u044f \u043c\u043e\u0433\u0443 \u043d\u0430\u043a\u0438\u0434\u0430\u0442\u044c \u043b\u044e\u0431\u044b\u0435 \u0444\u0430\u0439\u043b\u044b \u0434\u043b\u044f \u043c\u043e\u043d\u0442\u0430\u0436\u0430 \u0432 \u043e\u0434\u043d\u0443 \u043f\u0430\u043f\u043a\u0443, \u0437\u0430\u0442\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438 \u043b\u0435\u0433\u043a\u043e \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u0441\u0435 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0432 premiere pro.<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0428\u0442\u043e\u0448. \u041a\u043e\u0434 \u043b\u0435\u0436\u0438\u0442 \u043d\u0430 <a href=\"https:\/\/github.com\/lesskop\/file-sorter\" rel=\"noopener noreferrer nofollow\">GitHub.<\/a> \u0411\u0435\u0440\u0438\u0442\u0435, \u0438\u0437\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u043f\u043e\u0434 \u0441\u0435\u0431\u044f, \u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0437\u0434\u043e\u0440\u043e\u0432\u044c\u0435. \u0411\u0443\u0434\u0443 \u0440\u0430\u0434 \u043b\u044e\u0431\u043e\u043c\u0443 \u0444\u0438\u0434\u0431\u0435\u043a\u0443.<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/562362\/\"> https:\/\/habr.com\/ru\/post\/562362\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-324780","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324780","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=324780"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/324780\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=324780"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=324780"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=324780"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}