If I create a folder in a root directory, where the folder name is generated by a script.py giving it a name with todays date(YYYY-mm-dd). how do I reference that folder from another script (or the same script at a later stage) in the same directory after it's creation?
Asked
Active
Viewed 42 times
-4
-
1...You use today's date to reference it? – Aran-Fey Nov 11 '17 at 10:44
-
1Huh? Put the folder name into a variable? – timgeb Nov 11 '17 at 10:45
-
Are you trying to automatically detect new folders being created? If so, take a look [here](https://stackoverflow.com/questions/597903/monitoring-contents-of-files-directories). – Aran-Fey Nov 11 '17 at 10:47
-
1@Rawing "today's date" might change during execution. :) – timgeb Nov 11 '17 at 10:47
1 Answers
0
There are several options:
- Use today's date to construct the same name in the other script
- Have the scripts share a common parent environment or calling script that passes the name to both scripts
- Use interprocess communication between the scripts
- Have the scripts read the filename from a common location (e.g. a file known to both scripts)

René Pijl
- 4,310
- 1
- 19
- 25
-
Thanks for your help. Option 1 seems to be the easiest solution for what I'm trying to accomplish. – B.Ahern Nov 11 '17 at 11:54
-
Yes, but it only works on the same day, and there is a race condition :-) – René Pijl Nov 11 '17 at 11:55