0

我在一个文件夹中有许多具有特定扩展名的文件,我想要更改它们的扩展名(与这些文件的特定可执行程序相关联)

import glob, os, shutil, os, errno, sys
import subprocess
from glob import glob
from os import getcwd
from os.path import join
from os.path import basename
from subprocess import call

camino = 'C:\\Users\\user\\Desktop\\Dats\\COX\\' 
listado = glob(join(camino,'D*','20*','B*','1*'))

for archivo in listado:
    tmp = os.path.split(archivo)
    path = tmp[0]
    log = archivo
    estacion = os.path.basename(tmp[0])

    try:
        print (path)
        os.chdir(path)
        subprocess.call(['C:\\Users\\user\\Desktop\\Dats\\rt_mseed.exe', log])

    except OSError as e:
        if e.errno == errno.ENOTDIR:
             print ('error')
        else:
             print ('Error: %s' % e)

我有这个高级代码,运行时会显示此错误。

C:\Users\user\Desktop\Dats\python listado.py
C:\Users\user\Desktop\Dats\COX\DISK1\2014322\B088
Error: [Error 2] The system cannot find the file specified
C:\Users\user\Desktop\Dats\COX\DISK1\2014323\B088
Error: [Error 2] The system cannot find the file specified
C:\Users\user\Desktop\Dats\COX\DISK1\2014324\B088
Error: [Error 2] The system cannot find the file specified
C:\Users\user\Desktop\Dats\COX\DISK1\2014325\B088
Error: [Error 2] The system cannot find the file specified
C:\Users\user\Desktop\Dats\COX\DISK1\2014326\B088
Error: [Error 2] The system cannot find the file specified
4

0 回答 0