This project is read-only.

SFTP move file

Jul 18, 2011 at 4:56 PM

Hi guys.

Before I cause a huge mess on the server I'm working on, could someone tell me how to move files between directories on the server?
I was thinking of implementing a RenameFile(), but I'm not sure it's the best way to do it.

Thanks!

Jul 18, 2011 at 6:01 PM

Aij!!

First rule of anything software development related;

DO NOT USE PRODUCTION FOR "TESTING"/"HOPE-IT-WORKS"  KIND OF THINGS! - PERIOD

 

Now that that's cleared up, before I answer you, I must insist you download some kind of VM tool, such as VirtualBox, and install a lightweight Linux/BSD/Unix/PickYourPoison. This library is not out of beta, so there is endless of possibilities for shit to happen, even though code confidence is high. Obviously you should consider the risk, if you do proceed that is, how much time would YOU use for restoring things?

And yes, I am abit harsh with you here, because I am a certified software tester, and ... well, shit happens all the time, it's just a matter of fact.

The way of renaming is somethig of a Windows thing, think about it, if you rename something, what you actually are doing is moving, not in the Windows-sense anyway.

Coordinator
Jul 18, 2011 at 6:11 PM

Hi,

 

Just to add.

RenameFile is already implemented so you dont have to implement anything new, and behind the scene what it does it executes move command(or rename) depends on underlying OS.

So I would say its pretty safe to use RenameFile command and let OS to figure out how to do it. As far as I know, if file located on the same physical device it will simple change record in the directory to point it to different location.

 

Hope it helps,

Oleg