Python Forum
Python Paramiko mkdir command overwriting existing folder. How can i stop that?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Paramiko mkdir command overwriting existing folder. How can i stop that?
#1
I'm trying to create a register system based on server. Sending directories to my server with their name. But if you try to register with an existing username, you can. I don't want that... Tried that before in my own computer with os.mkdir() and worked perfectly. But when i remote control my server and use mkdir that just overwrites the old one. How can i fix that? Here is my code;
    try:
                stdin, stdout, stderr = ssh.exec_command('cd Server_Data;cd Users;mkdir '+userName)
            except:
                print("There is a registered user with the same name. Please choose another one.")
            else:
                savedUser = userName
                stdin, stdout, stderr = ssh.exec_command('cd Server_Data;cd Users;cd '+userName+';echo ' + userName + ' > rUser.txt')
                savedPass = password
                stdin, stdout, stderr = ssh.exec_command('cd Server_Data;cd Users;cd '+userName+';echo ' + password + ' > rPassw.txt')
Reply
#2
No replies sad
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  directory not being created after os.mkdir() CAD79 3 294 Mar-16-2024, 04:00 PM
Last Post: deanhystad
Question How to add Python folder in Windows Registry ? Touktouk 1 206 Feb-20-2024, 01:04 PM
Last Post: DeaD_EyE
  Python best library for Excel reports & review of existing code MasterOfDestr 4 492 Feb-14-2024, 03:39 PM
Last Post: MasterOfDestr
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 465 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  Python beginner that needs an expression added to existing script markham 1 664 Sep-04-2023, 05:24 AM
Last Post: Pedroski55
  python gzip all files from a folder mg24 3 3,807 Oct-28-2022, 03:59 PM
Last Post: mg24
  OSERROR When mkdir Oshadha 4 1,658 Jun-29-2022, 08:50 AM
Last Post: DeaD_EyE
  Make a python folder .exe Extra 0 999 Jun-10-2022, 01:20 AM
Last Post: Extra
  Dynamic File Name to a shared folder with open command in python sjcsvatt 9 5,876 Jan-07-2022, 04:55 PM
Last Post: bowlofred
  Compare filename with folder name and copy matching files into a particular folder shantanu97 2 4,390 Dec-18-2021, 09:32 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020