Script example of renaming a directory remote files

Client feature requests, product gripes, and other general questions.

Locked
ForumAdmin
Site Admin
Posts: 979
Joined: Mon Mar 24, 2003 4:37 am

Script example of renaming a directory remote files

Post by ForumAdmin »

This example uses the -dira command to retrieve a directory listing of files, which in this case are then renamed via a call to coreftp to process a script.

This example could be used for a variety of instances were remote files need to be processed. All that needs to be changed is the FTP commands that are used in the dumpcmd routine.

list.bat:

"\program files\coreftp\corecmd.exe" -s -site yoursite -dira /*.txt c:\data\dir.out

setlocal
@echo on

del c:\data\script.cmd

for /f "tokens=9" %%x in (c:\data\dir.out) do call :dumpcmd %%x

if EXIST c:\data\script.cmd "\program files\coreftp\corecmd.exe" -s -site mysite -dira -scal c:\data\script.cmd -log c:\data\script.log


:dumpcmd

if "%1"=="" goto:eof
echo RNFR /%1 >> c:\data\script.cmd
echo RNTO /%1.done >> c:\data\script.cmd

goto:eof
Locked