GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Python/move_files_over_x_days.py at master · Javier4/Python

Expand file tree

/

move_files_over_x_days.py

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
23 lines (18 loc) · 773 Bytes
/

move_files_over_x_days.py

Copy path

File metadata and controls

23 lines (18 loc) · 773 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
# Script Name : move_files_over_x_days.py# Author : Craig Richards# Created : 8th December 2011# Last Modified :# Version : 1.0# Modifications :# Description : This will move all the files from the src directory that are over 240 days old to the destination directory.import shutilimport sysimport timeimport ossrc = 'u:\\test' # Set the source directorydst = 'c:\\test' # Set the destination directorynow = time.time() # Get the current timefor f in os.listdir(src): # Loop through all the files in the source directory if os.stat(f).st_mtime < now - 240 * 86400: # Work out how old they are, if they are older than 240 days old if os.path.isfile(f): # Check it's a file shutil.move(f, dst) # Move the files
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.