Move Files to another folder

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
dantomlin
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 43
Joined: Tue Feb 26, 2008 4:07 pm

Move Files to another folder

Post by dantomlin » Fri Jul 23, 2010 4:03 pm

I have files on an FTP site which I can read no problem but after I do some processing, I want to move the files to another folder on the FTP site so they don't get processed a second time. I can copy and then delete or just move.

Any suggestions would be greatly appreciated....

Thanks, Dan

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Move Files to another folder

Post by Mark » Sat Jul 24, 2010 10:23 am

Hi Dan,

Try this:

Code: Select all

put "RNFR" && theDir & theFilename into myCommand
put libUrlFtpCommand(myCommand,myDomain,gUserName,gPassword) into rslt
put "RNTO" && theNewDir & theFilename into myCommand
put libUrlFtpCommand(myCommand,myDomain,gUserName,gPassword) into rsl
Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

dantomlin
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 43
Joined: Tue Feb 26, 2008 4:07 pm

Re: Move Files to another folder

Post by dantomlin » Fri Jul 30, 2010 5:59 pm

I tried this and I'm getting the following errors which I don't really understand...

550 file unavailable, user profile has no access

553 could not rename file

Any ideas?

Thanks, Dan

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Move Files to another folder

Post by Mark » Fri Jul 30, 2010 6:03 pm

Dan,

Did you just copy and paste my example, or did you change it to accommodate your requirements? What I pasted really is nothing but an example, which should give you some idea of what you should do.

Best,

mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

dantomlin
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 43
Joined: Tue Feb 26, 2008 4:07 pm

Re: Move Files to another folder

Post by dantomlin » Fri Jul 30, 2010 6:16 pm

No, I put in the file, login and etc into the variables... here is the code, I just xx'ed out the username and password for purposes of posting

Code: Select all

 put the cFileName of grp "FileInfo" into theFilename
   put "/download/" into theDir
   put "/download/processed" into theNewDir
   put "67.210.32.14" into myDomain
   put "xxxxxx" into tUserName
   put "xxxxxx" into tPass
      
   put "RNFR" && theDir & theFilename into myCommand
   put libURLftpCommand(myCommand,myDomain,tUserName,tPass) into rslt
   answer rslt
   put "RNTO" && theNewDir & theFilename into myCommand
   put libURLftpCommand(myCommand,myDomain,tUserName,tPass) into rsl
   answer rsl

dantomlin
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 43
Joined: Tue Feb 26, 2008 4:07 pm

Re: Move Files to another folder

Post by dantomlin » Fri Jul 30, 2010 8:04 pm

It's working now... once I got the IT guy to give the correct writes to the user and I got my directories correct, the file is being moved.

Thanks for the help, it is greatly appreciated....

Dan

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Move Files to another folder

Post by Mark » Fri Jul 30, 2010 8:15 pm

Thank for letting me know that it works, Dan. I was just going to look into it.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

Post Reply