ready to delete duplicated files
This commit is contained in:
parent
5ed4d99f43
commit
65d20e9701
@ -1,4 +1,5 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
from numpy import source
|
from numpy import source
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
@ -15,6 +16,11 @@ if __name__ == "__main__":
|
|||||||
type=str,
|
type=str,
|
||||||
help='csv file to the directory that be compared')
|
help='csv file to the directory that be compared')
|
||||||
|
|
||||||
|
parser.add_argument('--remove',
|
||||||
|
type=str,
|
||||||
|
help='remove duplicated file or not',
|
||||||
|
choices=['True','False'])
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
csv_source = args.source
|
csv_source = args.source
|
||||||
csv_target = args.target
|
csv_target = args.target
|
||||||
@ -41,3 +47,6 @@ if __name__ == "__main__":
|
|||||||
for row in df_filtered.Path:
|
for row in df_filtered.Path:
|
||||||
p = pathlib.Path(row)
|
p = pathlib.Path(row)
|
||||||
print(str(p) + ": " + str(p.exists()))
|
print(str(p) + ": " + str(p.exists()))
|
||||||
|
if args.remove == "True" and p.exists() == True:
|
||||||
|
os.remove(p)
|
||||||
|
print(str(p) + " Removed")
|
@ -101,7 +101,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if args.csv_path:
|
if args.csv_path:
|
||||||
csv_path = args.csv_path
|
csv_path = args.csv_path
|
||||||
df_csv.to_csv(csv_path)
|
df_csv.to_csv(csv_path,index_label='Index')
|
||||||
else:
|
else:
|
||||||
for x in paths:
|
for x in paths:
|
||||||
print(str(x))
|
print(str(x))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user