我正在尝试创建一个脚本,该脚本将使用文件夹标记更改windows文件夹的颜色。我正在使用Excel中的条件单元格示例。如果子文件夹中有文件,我希望将文件夹变为绿色,否则变为红色
我几乎没有使用python或任何其他脚本语言的经验,我完全迷路了。这是我到目前为止得到的
import os
import subprocess
from os import walk, rename
from subprocess import call
#if/else statements for setting folder color based on number of songs in each folder
directory = 'E:\Projects\Ableton\Finished Tracks\2 Finished' #detailing the directory for the script to run
for folder, subfolders, filenames in os.walk(directory): #idk what this does, i saw it on stack
if any([filename.endswith('.wav') for filename in filenames]): #searching for any songs in the directory
FolderMarker = 'C:\Program Files (x86)\Folder Marker\\FolderMarker.exe' #detailing file path for FolderMarker
call(["C:\Program Files (x86)\Folder Marker\FolderMarker.exe"]) #launching FolderMarker if true
我尝试使用os.startfile
目前没有回答
相关问题 更多 >
编程相关推荐