0

I know you can use os.chdir(dir) in python to revert back and forth but is there a simpler option(in the libraries or ftplib) to temporarily change the directory until the ftp transfer is over in python.

I basically want to temporarily change the current directory during the ftp transfer only.

user126885
  • 157
  • 1
  • 2
  • 10

1 Answers1

1

No, there is nothing in the standard libraries nor ftplib that temporarily changes the current working directory and restores it after the ftplib transfer.

There are several alternatives that you can implement yourself, however. See Python - How do I write a decorator that restores the cwd? for several good ideas.

Community
  • 1
  • 1
Robᵩ
  • 163,533
  • 20
  • 239
  • 308