I would like to know how to retrieve all the values of my loop via a Return. In my first function, I loop to recover all my folders, subfolders. Then I go back to pathFiles
In my second function, I test my linux command on all files in folders, but the problem is this: my function only tests the last result of my loop and not all values.
from ftplib import FTP
import ftplib
import os
import errno
import time
class ProcessFile:
path= "FolderFiles"
target=" /var/www/folder/Output"
extract=""
monitoring=""
bash="unrar "
@staticmethod
def returnPath():
pathFiles= []
for root, dirs, files in os.walk(ProcessFile.path, topdown=True):
for name in dirs:
os.path.join(root, name)
for name in files:
pathFiles= os.path.join(root, name)
print(pathFiles)
return pathFiles
@staticmethod
def testArchive(pathFile):
monitoring = ProcessFile.bash+"t "+pathFile
verifyFiles = os.system(monitoring)
return verifyFiles
def testCodeRetour():
myPath = ProcessFile.returnPath()
print(myPath)
Do you have any idea how it works?
Thank you for your help