-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuntarr.py
More file actions
executable file
·28 lines (24 loc) · 825 Bytes
/
untarr.py
File metadata and controls
executable file
·28 lines (24 loc) · 825 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
#!/usr/bin/env python
#M.C. Toribio
#toribio@astron.nl
#
#Script to untar data retrieved from the LTA by using wget
#It will DELETE the .tar file after extracting it.
#
#Notes:
#When using wget, the files are named, as an example:
#SRMFifoGet.py?surl=srm:%2F%2Fsrm.grid.sara.nl:8443%2Fpnfs%2Fgrid.sara.nl%2Fdata%2Flofar%2Fops%2Fprojects%2Flofarschool%2F246403%2FL246403_SAP000_SB000_uv.MS_7d4aa18f.tar
# This scripts will rename those files as the string after the last '%'
# If you want to change that behaviour, modify line
# outname=filename.split("%")[-1]
#
# Version:
# 2014/11/12: M.C. Toribio
import os
import glob
for filename in glob.glob("*SB*.tar*"):
outname=filename.split("%")[-1]
os.rename(filename, outname)
os.system('tar -xvf '+outname)
os.system('rm -r '+outname )
print(outname+' untarred.')