• ClipSaver
  • dtub.ru
ClipSaver
Русские видео
  • Смешные видео
  • Приколы
  • Обзоры
  • Новости
  • Тесты
  • Спорт
  • Любовь
  • Музыка
  • Разное
Сейчас в тренде
  • Фейгин лайф
  • Три кота
  • Самвел адамян
  • А4 ютуб
  • скачать бит
  • гитара с нуля
Иностранные видео
  • Funny Babies
  • Funny Sports
  • Funny Animals
  • Funny Pranks
  • Funny Magic
  • Funny Vines
  • Funny Virals
  • Funny K-Pop

Delete files based on modified date using Python скачать в хорошем качестве

Delete files based on modified date using Python 3 года назад

скачать видео

скачать mp3

скачать mp4

поделиться

телефон с камерой

телефон с видео

бесплатно

загрузить,

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
Delete files based on modified date using Python
  • Поделиться ВК
  • Поделиться в ОК
  •  
  •  


Скачать видео с ютуб по ссылке или смотреть без блокировок на сайте: Delete files based on modified date using Python в качестве 4k

У нас вы можете посмотреть бесплатно Delete files based on modified date using Python или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:

  • Информация по загрузке:

Скачать mp3 с ютуба отдельным файлом. Бесплатный рингтон Delete files based on modified date using Python в формате MP3:


Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса ClipSaver.ru



Delete files based on modified date using Python

Code link: https://github.com/oscarito-taquito/y... Free uDemy Courses: https://www.udemy.com/user/oscar-2330/ Buy me a coffee: https://buymeacoffee.com/oscarito Affiliate Savings: https://analystscorner.net/affiliates... Python Script to Manage File Information and Clean Up Old Files Description: Today, I'm happy to share with you a Python script I wrote that helps manage and clean up old files from your computer. This script is perfect for anyone who wants to keep their digital workspace organized and clutter-free. Whether you're a college freshman like me or a seasoned programmer, this tutorial will guide you through understanding and using the script. So, let's dive in! Video Overview In this video, I'll walk you through a Python script that does the following: 1. *Gets the current working directory* - We'll use `os.getcwd()` to find out where we are currently working. 2. *Lists all files in the directory* - Using `os.listdir()`, we'll gather all the files in our current directory. 3. *Captures file information* - We'll create a function to retrieve creation and modification dates of each file. 4. *Calculates the age of files* - We'll determine how many days old each file is. 5. *Sorts files by modification date* - Organizing files based on when they were last modified. 6. *Decides whether to delete or keep files* - Based on the age of the files, we'll decide which files to keep and which to remove. Script Breakdown Here's a detailed look at the script: #### Importing Libraries ```python import os import datetime as dt ``` We start by importing the necessary libraries. `os` is used for interacting with the operating system, and `datetime` helps us work with dates and times. #### Getting Current Directory and File List ```python cur_path = os.getcwd() files = os.listdir(cur_path) now = dt.datetime.today() ``` We retrieve the current directory path using `os.getcwd()` and list all the files in that directory with `os.listdir()`. We also get the current date and time with `dt.datetime.today()`. #### Capturing File Information ```python def file_info(cd, file_list, today): file_dict = {} for file in file_list: file_path = os.path.join(cd, file) created = os.stat(file_path) created = dt.datetime.fromtimestamp(created.st_birthtime) modified = dt.datetime.fromtimestamp(os.path.getmtime(file_path)) since_created = int((today - created).total_seconds() / (60 * 60 * 24)) since_mod = int((today - modified).total_seconds() / (60 * 60 * 24)) file_dict[file] = [file_path, file, f"{created}", f"{modified}", since_created, since_mod] return file_dict ``` We define a function `file_info()` that takes the current directory, a list of files, and the current date as arguments. This function gathers information about each file, including its path, creation date, modification date, and age in days. It stores this information in a dictionary. #### Sorting Files by Modification Date ```python dir_listing = file_info(cur_path, files, now) print(dir_listing) dir_listing_sort = sorted(dir_listing.items(), key=lambda x: x[1][5]) ``` We call the `file_info()` function and print the resulting dictionary. Then, we sort the files based on their modification dates. #### Deciding to Delete or Keep Files ```python for k, v in dir_listing_sort: print(v[1], v[5]) if v[5] gt 250: os.remove(v[0]) print('Delete File') else: print('Keep File') ``` We loop through the sorted file list and decide whether to delete or keep each file based on its age. If a file is older than 250 days, we mark it for deletion. Otherwise, we keep it. Conclusion I hope you found this tutorial helpful! This script is a great starting point for managing and organizing your files. Feel free to modify and expand upon it to suit your needs. If you have any questions or suggestions, leave a comment below. Don't forget to like, share, and subscribe for more awesome content! *Tags:* Python, File Management, Cleanup Script, Organize Files, Python Tutorial, College Freshman, Programming Basics, Python for Beginners, Learn Python, Coding Tips, Digital Organization, File Information, Delete Old Files, Python Script Tutorial, os module, datetime module Thanks for watching!

Comments
  • Декораторы Python — наглядное объяснение 2 месяца назад
    Декораторы Python — наглядное объяснение
    Опубликовано: 2 месяца назад
  • Scripting with Python - Modify a TXT file 5 лет назад
    Scripting with Python - Modify a TXT file
    Опубликовано: 5 лет назад
  • Правильное именование файлов и каталогов 3 месяца назад
    Правильное именование файлов и каталогов
    Опубликовано: 3 месяца назад
  • Filtering .log files, with cat, grep, cut, sort, and uniq 5 лет назад
    Filtering .log files, with cat, grep, cut, sort, and uniq
    Опубликовано: 5 лет назад
  • Организация файлов с помощью Python: переименование, перемещение, копирование и удаление файлов и... 3 года назад
    Организация файлов с помощью Python: переименование, перемещение, копирование и удаление файлов и...
    Опубликовано: 3 года назад
  • Share Your Python Code as a Single Clickable .exe File 4 дня назад
    Share Your Python Code as a Single Clickable .exe File
    Опубликовано: 4 дня назад
  • Почему я перешел на Zed? 8 месяцев назад
    Почему я перешел на Zed?
    Опубликовано: 8 месяцев назад
  • Word Length and Paragraph Word Length Counter 2 года назад
    Word Length and Paragraph Word Length Counter
    Опубликовано: 2 года назад
  • Python if __name__ == '__main__': наглядное объяснение 11 месяцев назад
    Python if __name__ == '__main__': наглядное объяснение
    Опубликовано: 11 месяцев назад
  • How to Easily Find Keywords in a Document with KeyBERT in Python 2 года назад
    How to Easily Find Keywords in a Document with KeyBERT in Python
    Опубликовано: 2 года назад
  • Я ненавижу длинные цепочки If-Elif: этот шаблон проектирования решил эту проблему раз и навсегда 3 месяца назад
    Я ненавижу длинные цепочки If-Elif: этот шаблон проектирования решил эту проблему раз и навсегда
    Опубликовано: 3 месяца назад
  • Python Tutorial: Logging Basics - Logging to Files, Setting Levels, and Formatting 8 лет назад
    Python Tutorial: Logging Basics - Logging to Files, Setting Levels, and Formatting
    Опубликовано: 8 лет назад
  • If Statements and User Inputs 7 лет назад
    If Statements and User Inputs
    Опубликовано: 7 лет назад
  • WHAT Is 3 года назад
    WHAT Is "Glob" In Python?! (It's Actually Very Useful!)
    Опубликовано: 3 года назад
  • Ускоренный курс LangChain для начинающих | Учебное пособие по LangChain 2 года назад
    Ускоренный курс LangChain для начинающих | Учебное пособие по LangChain
    Опубликовано: 2 года назад
  • Building an Automated File Sorter in File Explorer using Python | Python Projects for Beginners 2 года назад
    Building an Automated File Sorter in File Explorer using Python | Python Projects for Beginners
    Опубликовано: 2 года назад
  • Music for Men Who Stay Silent | Gentleman Dark Blues 1 месяц назад
    Music for Men Who Stay Silent | Gentleman Dark Blues
    Опубликовано: 1 месяц назад
  • Курс Python с Абсолютного нуля! [12 часов из 80] Python курс - качественный старт для начинающих! 7 месяцев назад
    Курс Python с Абсолютного нуля! [12 часов из 80] Python курс - качественный старт для начинающих!
    Опубликовано: 7 месяцев назад
  • Visualizing Excel Files Easily With Python 3 года назад
    Visualizing Excel Files Easily With Python
    Опубликовано: 3 года назад
  • Как читать текстовый файл .txt на Python! Извлечение данных, фильтрация и изменение информации! 4 года назад
    Как читать текстовый файл .txt на Python! Извлечение данных, фильтрация и изменение информации!
    Опубликовано: 4 года назад

Контактный email для правообладателей: u2beadvert@gmail.com © 2017 - 2026

Отказ от ответственности - Disclaimer Правообладателям - DMCA Условия использования сайта - TOS



Карта сайта 1 Карта сайта 2 Карта сайта 3 Карта сайта 4 Карта сайта 5