-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathccp.py
More file actions
executable file
·54 lines (50 loc) · 1.4 KB
/
ccp.py
File metadata and controls
executable file
·54 lines (50 loc) · 1.4 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
import os
import sys
import random
import time
from random import seed, randint
import argparse
import platform
from datetime import datetime
import glob
from time import sleep
import fileinput
import numpy as np
import pandas as pd
import subprocess
# Useful codes
# os.system("awk '{print $NF}' all_wham.dat > e_total")
# tr " " "\n"
# sed 1d
# sort -u -k 3
# sed -e 's/+T//'
# import re
# numbers = re.compile(r'(\d+)')
# def numericalSort(value):
# parts = numbers.split(value)
# parts[1::2] = map(int, parts[1::2])
# return parts
# mypath = os.environ["PATH"]
# os.environ["PATH"] = "/home/wl45/python/bin:/home/wl45/opt:" + mypath
# my_env = os.environ.copy()
parser = argparse.ArgumentParser(description="ccp.py from to")
parser.add_argument("source", help="copy from")
parser.add_argument("to", help="copy to")
parser.add_argument("-m", "--mode", type=int, default=0)
args = parser.parse_args()
# find directory1 -type f -size +500k -exec cp -nv {} directory2/ \;
my_from = args.source
my_to = args.to
if args.mode == 0:
cmd = f"rsync -a --exclude='*.pkl' --exclude='*.dat' --exclude='*.out' {my_from} {my_to}"
print(cmd)
os.system(cmd)
if args.mode == 1:
cmd = f"rsync -a --exclude='fraglib' {my_from} {my_to}"
print(cmd)
os.system(cmd)
if args.mode == 2:
cmd = f"rsync -a --exclude='*.out' --exclude='phis' {my_from} {my_to}"
print(cmd)
os.system(cmd)