0

I'm making an app that collects such as time spent on application etc., and stores it in a folder, to make it neat I want create directories automatically with the date as the name of the directory and save file on that day to it.

How can I create folders daily automatically having name as the date

1
  • 3
    did you try anything? do you have a concept how to approach this? Commented Jun 22, 2020 at 11:46

2 Answers 2

2

Don't bother creating folders on certain times, just check if the required folder exists when you want to write the file into it. If it doesn't, create it right then and there. Format the current date into the name of the folder.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use the os module to make a folder. And to make a folder everyday you can make a while loop and you can use the time module for it.

And you can name it by saying -

date.today()

inside the argument of the makedirs method

Hope it helped a bit :)

4 Comments

I guess you would not want to stall all your script with a sleep for one day...
You are right, there are also other methods to do this
This is little more than links. Please make sure you post a helpful and complete answer here, links are only helpful for referencing further details. Do make sure the answer is your own work however, don’t copy.
Okay sorry i will not do that again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.