# -*- coding: utf-8 -*-
import glob, os
import pandas as pd
import csv

path = 'C:/Users/akuas/Desktop/watchdog/re/*.tdms'

# sampleフォルダ内にあって拡張子がpyのファイル名を取得
file_list = glob.glob(path, recursive=True)

# ファイル名だけを抽出
file_list = [os.path.basename(r) for r in file_list]

csv_file = 'test.csv'
with open(csv_file, "w", newline="") as f:
    csv_writer = csv.writer(f)
    csv_writer.writerow(['ID',])
    for line in file_list:
        line = line.rstrip('\n').split(',')
        csv_writer.writerow(line)

path = 'C:/Users/akuas/Desktop/watchdog/rere/*.tdms'

# sampleフォルダ内にあって拡張子がpyのファイル名を取得
file_list = glob.glob(path, recursive=True)

# ファイル名だけを抽出
file_list = [os.path.basename(r) for r in file_list]

csv_file = 'test2.csv'
with open(csv_file, "w", newline="") as f:
    csv_writer = csv.writer(f)
    csv_writer.writerow(['ID',])
    for line in file_list:
        line = line.rstrip('\n').split(',')
        csv_writer.writerow(line)





df1 = pd.read_csv('test.csv',encoding='cp932')
df2 = pd.read_csv('test2.csv',encoding='cp932')

ret = df2[~df2.ID.isin(df1.ID)]
ret.to_csv('test3.csv', index=None)