36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
|
'''
|
||
|
Copies all missing files from ROOT to DEST for selected PARTICIPANTS
|
||
|
'''
|
||
|
import os, sys
|
||
|
import shutil
|
||
|
|
||
|
PARTICIPANTS = ['p10', 'p16', 'p13', 'p24', 'p5', 'p14', 'p26', 'p12', 'p20', 'p7', 'p15', 'p11', 'p21', 'p25']
|
||
|
|
||
|
DEST = '/home/mmbrian/3D_Gaze_Tracking/archive00/participants/'
|
||
|
ROOT = '/home/mmbrian/HiWi/etra2016_mohsen/code/recording/data/participants/'
|
||
|
|
||
|
def main():
|
||
|
processed = 0
|
||
|
for p in os.listdir(ROOT):
|
||
|
if p in PARTICIPANTS:
|
||
|
print '> Copying missing files for participant', p
|
||
|
d1 = os.path.join(ROOT, p)
|
||
|
d1 = os.path.join(d1, os.listdir(d1)[0]) # ../p_i/../
|
||
|
for d2 in os.listdir(d1): # per recording
|
||
|
root_path = os.path.join(d1, d2)
|
||
|
dest_path = os.path.join(DEST, p)
|
||
|
dest_path = os.path.join(dest_path, os.listdir(dest_path)[0], d2)
|
||
|
print '> From:', root_path, 'To:', dest_path
|
||
|
processPath(root_path, dest_path)
|
||
|
processed+=1
|
||
|
print '> Processed %s participants.' % processed
|
||
|
|
||
|
def processPath(root_path, dest_path):
|
||
|
dest_files = os.listdir(dest_path)
|
||
|
for f in os.listdir(root_path): # every file from root path
|
||
|
if not f in dest_files: # copy if file does not exist in destination
|
||
|
print '> Copying', f
|
||
|
shutil.copyfile(os.path.join(root_path, f), os.path.join(dest_path, f))
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|