|
Humble Request Problem: I have a scientific instrument that collects data on samples to individual folders. I would like to be able to go back and calculate how much instrument time was used on each sample. Description and requirements: The instrument runs on Windows 7. I think the easiest way to do this would be via the created date and time on the files that the instrument generates. The file structure for the datasets is : code:
I imagine this wouldn’t be too tough to do with a script, but it’s beyond my abilities. What would be useful to me would be a script that gives an output in time in hours on a per sample basis. Nice to have features: I think a really nice output format would be something along the lines of: code:
|
# ¿ Nov 15, 2017 18:13 |
|
|
# ¿ May 17, 2024 02:18 |
|
Ptarmigans posted:Here's what I got with a quick go at it in Python. I'm not 100% on what your preferred formatting is but let me know if you want any changes. Thanks for the effort, I installed python 2.7.14 for windows, but trying to run the script gives a syntax error: code:
I also swapped out getctime for getmtime, since apparently copying the data to a new drive (which I do occasionally) gives new created dates but not modified dates. Now when I call the script (F:\test>python test.py) it writes this to the console: code:
It also doesn't appear to check that the files whose dates its using for the calculation match the string "Samplename_" Seriously, this is a pretty awesome start. Thanks.
|
# ¿ Nov 17, 2017 01:26 |
|
Ptarmigans posted:Sorry about that, I should have specified that it's for Python 3, which doesn't have compatibility with Python 2. Awesome. I added a couple of features. 1) now it only uses files that match the sample name for the calculation. 2) Added error handling for when it encounters subfolders that don't have the expected path (would throw up if there was a missing frames folder) code:
|
# ¿ Nov 18, 2017 18:05 |