-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathutils.py
More file actions
34 lines (28 loc) · 804 Bytes
/
utils.py
File metadata and controls
34 lines (28 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env python
# encoding: utf-8
#===========================================================
#
# utils.py
#
# 12-Sept-2011
# M. Hadmack (michael.hadmack@gmail.com)
#
# automatic file naming tools
#
# Note that this is also part of the fel_utils module and
# only duplicated here as a backup
#===========================================================
import time
import os
import sys
def makeFileName():
timestring = time.strftime("%H%M%S")
return timestring
def makeDataFilePath(root="/var/local/data", subdir="scope"):
datestring = time.strftime("%y%m%d")
fileroot = os.path.join(root, datestring, subdir)
filename = makeFileName()
if not os.path.exists(fileroot):
os.makedirs(fileroot)
filepath = os.path.join(fileroot, filename)
return filepath