-2

First time using this website, i have a challenge now with one of our clients that they are blocking our SFTP account if we connect and do not send any file. Something that i am looking for is a script for powershell or could be anything that i can build into .exe file with visual studio so that the script firstly would check:

Check if file exists If False then stop If true open sftp and send the file

any help would be trully appreciated!

1 Answers1

0

You can use a try-except block to figure out if the file is open

try:
    file = open("Your file's location",'r')
except:
    pass
else:
    # Everything else goes here #
    file.close()
Salman B
  • 138
  • 11
  • What i found usefull is: test-path FILEPATHt\*.txt Then i use if else but now im a bit strugling on SFTP script for powershell.. on simple ftp it was rather easy "open ftp.blablabla.com" Not working on sftp this properly.. :( – Mindaugas Jonikas Sep 01 '20 at 12:51
  • Try updating your question to give me as much information as possible – Salman B Sep 01 '20 at 15:00