Woody
Woody

Reputation: 145

How to use ftp.rename() to move one directory to another in Python using ftplib?

I have a NAS which having below file structures:

Say I have a movie directory "Terminator" which stores in below directory:

/media_staging/Terminator

    From Destination: /media_staging/Terminator
    To Destination:   /video/
    
    *Note: media_staging & video are in the same file level

So how could I use the ftp.rename to move the 'Terminator' file from under media_staging to video?

Can I do it with something like this:

ftp.rename('/media_staging/Terminator','/video/Terminator')

As I could see it says there is permission issue in here...

May I know which is the right way?

Upvotes: 1

Views: 1510

Answers (1)

Woody
Woody

Reputation: 145

After few tries, found that the reason why have such error is that the file 'Media_staging' & 'video' are in different share folders which is unable to move files, if in the same share folder, the ftp.rename & ftp commands can be executed fine.

Upvotes: 1

Related Questions