Does FTPLIB have a 'local change directory' ?

P

python newbie

Hi, first I wanted to say that:

I have finally been able to ftp a file in my python app - however, it
works like this:

When you use storbinary and hand it a full path
"c:\myfiles\morefiles\picture.gif"..
it will find the file on your hard drive, and
then upload the file, but on the ftp server, it literally names the file:

"c:\myfiles\morefiles\picture.gif"


I'd like to be able to first

ftplib.lcd( "c:\myfiles\morefiles" )

and then just

storbinary( picture.gif .. ).

But the python doc doesn't show any LCD.

Or am I going to have to be satisfied with having to just use a rename on
the server,
after uploading the file?

Thanks
Steve
 
R

Robert Kern

python said:
Hi, first I wanted to say that:

I have finally been able to ftp a file in my python app - however, it
works like this:

When you use storbinary and hand it a full path
"c:\myfiles\morefiles\picture.gif"..
it will find the file on your hard drive, and
then upload the file, but on the ftp server, it literally names the file:

"c:\myfiles\morefiles\picture.gif"


I'd like to be able to first

ftplib.lcd( "c:\myfiles\morefiles" )

and then just

storbinary( picture.gif .. ).

But the python doc doesn't show any LCD.

os.chdir()

--
Robert Kern
(e-mail address removed)

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
 
J

jepler

If you want to change the working directory of a Python program, then use
os.chdir() for that purpose. That's what 'lcd' does in ftp client software.
It doesn't send a remote command of any kind.

Or, when you call the storbinary method, give the os.path.basename() of the
file you are storing, instead of the name you used to open the file on the local
system.

Jeff

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFC9WZgJd01MZaTXX0RAg6UAKCSztXi8VVC9PvkKprv5QwBctMDHwCgqSho
A7t6OLeHZBp/uXybH5wWXK4=
=5XcD
-----END PGP SIGNATURE-----
 
S

Steve Bailey

Yes, I tried using just the filename itself in using storbinary, but
it returned some kind of error, but your suggestion to use os.chdir is
so obvious I'm not sure why I didn't think of that.
Thanks for the email
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,311
Members
47,982
Latest member
DrewDemoss

Latest Threads

Top