修复编程单下发ftp路径
This commit is contained in:
@@ -32,11 +32,11 @@ class FtpController():
|
||||
for directory in directories:
|
||||
if directory:
|
||||
# 检查目录是否存在
|
||||
if directory in ['NC']:
|
||||
if (directory in ['NC']) or (directory not in ['home', 'ftp', 'ftp_root', 'NC']):
|
||||
self.ftp.cwd(directory)
|
||||
if directory not in ['home', 'ftp', 'ftp_root', 'NC']:
|
||||
# 切换到新的目录
|
||||
self.ftp.cwd(current_dir)
|
||||
self.ftp.cwd(directory)
|
||||
return os.path.basename(path)
|
||||
except Exception as e:
|
||||
logging.error(f"Error checking file: {e}")
|
||||
@@ -60,14 +60,13 @@ class FtpController():
|
||||
try:
|
||||
logging.info('FTP目录:%s' % target_dir)
|
||||
logging.info("进入FTP目录 ")
|
||||
# self.ftp.cwd(target_dir) # 切换工作路径
|
||||
# logging.info('FTP目录:%s' % target_dir)
|
||||
remotenames = self.ftp.nlst()
|
||||
logging.info('FTP目录文件:%s' % remotenames)
|
||||
for file in remotenames:
|
||||
server = os.path.join(serverdir, file)
|
||||
if file.find(".pdf") != -1:
|
||||
self.download_file(server, file)
|
||||
return True
|
||||
except:
|
||||
return False
|
||||
|
||||
|
||||
Reference in New Issue
Block a user