Skip to content

Instantly share code, notes, and snippets.

@sakag1975
Last active March 28, 2020 04:53
Show Gist options
  • Save sakag1975/49ba6e58fce1fe517fbf094b6a3a3c33 to your computer and use it in GitHub Desktop.
Save sakag1975/49ba6e58fce1fe517fbf094b6a3a3c33 to your computer and use it in GitHub Desktop.
move screen shot file
#!/usr/local/bin/python3
# -*- coding: utf-8 -*-
import os
import glob
import shutil
def main():
SCREEN_SHOT_DIR = os.environ['HOME'] + '/Pictures/'
CURRENT_DIR = os.getcwd()
file_list = glob.glob(SCREEN_SHOT_DIR + '*.png')
try:
src_file = max(file_list, key = os.path.getctime)
print('Move src:{0} dest:{1}'.format(src_file, CURRENT_DIR))
shutil.move(src_file, CURRENT_DIR)
except ValueError:
print('No file.')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment