Issue
I want to create a folder in which I can add a subfolder with the current date and a progressive number and move there a file in which I'm interested. After the connection to the ssh server is made, I send this code:
from datetime import datetime
i=0
now=datetime.now()
var_log='/var/log/gwlog_0_debug'
folder_Salvo='mkdir /Salvo/'+now.strftime('%m-%d-%Y')+'/'+str(i)
print (folder_Salvo)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(folder_Salvo)
path_Salvo=' /Salvo/'+now.strftime('%m-%d-%Y')+'/'+str(i)
log_Salvo= path_Salvo+'/gwlog_0_debug'
command='cp '+ var_log + log_Salvo
print (command)
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(command)
the output of the print commands seems correct
mkdir /Salvo/07-05-2022/0
cp /var/log/gwlog_0_debug /Salvo/07-05-2022/0/gwlog_0_debug
but the folder is not created. Any suggestions?
Solution
I've done like this:
folder="C:\try\attempts"
os.makedirs(folder)
Answered By - martinmistere Answer Checked By - Katrina (WPSolving Volunteer)