Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add timestamp to output to stop overwritting output #26

Open
gocyclones opened this issue Apr 6, 2017 · 3 comments
Open

Add timestamp to output to stop overwritting output #26

gocyclones opened this issue Apr 6, 2017 · 3 comments
Assignees

Comments

@gocyclones
Copy link

Can I make a suggestion to add a timestamp to the output so that it doesn' continue to overwrite itself on runs? I have done this with my own local copy by adding:
import time
and changing the CSV_writer sub to this:
csv_writer_subs = csv.writer(open(orgname + "_inventory_report." + time.strftime('%Y-%m-%d_%H:%M:%S') + ".csv", "wb"), delimiter=',', quotechar='"', quoting=csv.QUOTE_ALL)

Output for the file name looks like this now:
MyOrg_inventory_report.2017-04-03_19:34:05.csv

@sideangleside
Copy link
Member

+1 Though I despise colons : in filenames. (But that's personal preference).

@sideangleside sideangleside self-assigned this Apr 6, 2017
@gocyclones
Copy link
Author

Not hung up on the format, just was something easy to make it unique.

@evgeni
Copy link
Member

evgeni commented Apr 7, 2017

I think I'd add an --output switch, allowing the user to do whatever they want. And default it to something like %(org)s_inventory_report_%(time)s.csv.

Also -1 on colons. But that's fixable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants