Skip to content

Instantly share code, notes, and snippets.

@molcay
Last active November 21, 2016 08:23
Show Gist options
  • Save molcay/9dc299da9c26efcffdb8aed49a0811ae to your computer and use it in GitHub Desktop.
Save molcay/9dc299da9c26efcffdb8aed49a0811ae to your computer and use it in GitHub Desktop.
This script can list all files and subfolders. Actually, 'du -h' command do the jobs the other part includes timestamp to the text file.
#!/usr/bin/python
import datetime
import os
import sys
now = datetime.datetime.now()
# print now.year, now.month, now.day, now.hour, now.minute, now.second
filename = "{}-{}-{}-{}-{}-{}".format(now.year, now.month, now.day, now.hour, now.minute, now.second)
suffix = "FileList"
if len(sys.argv) > 1:
suffix = sys.argv[1]
filename = suffix + filename
os.system("du -h > {}.txt".format(filename))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment