我想写一个Python脚本,它允许我在达到一定年龄后从FTP服务器中删除文件.我准备了下面的scipt但它抛出了错误消息:WindowsError: [Error 3] The system cannot find the path specified: '/test123/*.*'
有人知道如何解决这个问题吗?先感谢您!
import os, time
from ftplib import FTP
ftp = FTP('127.0.0.1')
print "Automated FTP Maintainance"
print 'Logging in.'
ftp.login('admin', 'admin')
# This is the directory that we want to go to
path = 'test123'
print 'Changing to:' + path
ftp.cwd(path)
files = ftp.retrlines('LIST')
print 'List of Files:' + files
#--everything works fine until here!...
#--The Logic which shall delete the files after the are 7 days old--
now …Run Code Online (Sandbox Code Playgroud)