Moving files

Apr 5, 2013 at 7:00 PM
Thanks for a fantastic piece of code.

Is there any way to move files using the library? Or do I have to physically download the file, delete it from the server, then upload it to the new location? That seems a bit heavy handed, and I suspect I'm missing something obvious.

The FTP command I'm trying to replicate is basically this:
mv /directory/path/*.ext /directory/path2/*.ext 
Any pointers would be much appreciated!
Coordinator
Apr 5, 2013 at 7:01 PM
The rename function should do this for you. The FTP commands in question RNFR /path/to/original, RNTO /new/path/original, or something to that effect.
Apr 6, 2013 at 8:36 PM
Edited Apr 6, 2013 at 8:37 PM
Thanks for the super fast reply, what you suggested worked just fine, I suspected it would be something simple

Its only two lines of code, but here it is in case anybody else finds it useful:
// ^^ stuff before this iterates over all files in a set directory and
//          downloads any files
//
// I need to move any downloaded files into a subdirectory named "/processed/"


var path_destination = item.FullName.Substring(0, item.FullName.LastIndexOf("/")) + "/processed/" + item.Name;
 ftp.Rename(item.FullName, path_destination);