How to rename, copy and move uploaded files

Core FTP Server questions and answers
Post Reply
tstrugar
Posts: 7
Joined: Tue Dec 15, 2009 1:08 pm

How to rename, copy and move uploaded files

Post by tstrugar »

I am using Core FTP Server build 321 on a Win XPP SP3 machine. I have a single SFTP domain.

I have the folder structure:

d:\users\user1\sub1 ..\sub2 etc

Permissions on the home folder 'user1' are RWAD-LCRI

I can successfully manually add, remove, rename and delete files.

I would like to

a. move a file from sub1 to sub2
b. copy a file from sub1 to sub2
c. rename file.ext1 to file.ext2

For a. I placed the following command into the "Post upload command" field on the Script/commands tab for user1

cmd.exe /c move /y %1 %2\..\sub2

with return code 0, but nothing happens when I upload a file to folder sub1. The last entry in the log is the upload of the file.

If instead, I change the command to

cmd.exe /c move /y %1 %2\sub2

and upload a file to the root home folder, it works and the file is moved to the sub2 folder.


Finally, are there any other available variables besides just %1 (current file) and %2 (current path)?

Thanks in advance for any help.

Tomi
tstrugar
Posts: 7
Joined: Tue Dec 15, 2009 1:08 pm

Post by tstrugar »

p.s. If the file being copied has a space in its name, then you'll need to put "" around %1. The same goes for the path variable $2

ie. best to use

cmd.exe /c move /y "%1" "%2\sub2"

Tomi
tstrugar
Posts: 7
Joined: Tue Dec 15, 2009 1:08 pm

Post by tstrugar »

(I am now using build 323)

The info on the scripts page says that

%1 = current (file) name
%2 = current path

Nothwithstanding that, I have tried all the options you gave, both in a simple command line on the scripts page as well as in a bat file but none of them work.

Can the CoreFTP Server team please test and advise which is the correct syntax (there should only really be one correct syntax)?

I also found that I had to restart the CoreFTP Server in order to get the changes to the command line on the scripts page to work.

Thanks, Tomi
tstrugar
Posts: 7
Joined: Tue Dec 15, 2009 1:08 pm

Post by tstrugar »

I already tried those options, already knowing the correct values for %1 and %2, and they did not work.

Have you tried any of these options? Surely only one syntax could be correct? Can you please test and advise what works?

Thanks.
tstrugar
Posts: 7
Joined: Tue Dec 15, 2009 1:08 pm

Post by tstrugar »

Thanks CP. I upgraded to v327 and it is now working perfectly. Many thanks!
Post Reply