- martin
Post a reply
Topic review
- Archillion
loop and move the files with MSDOS
Hello everyone.
Here is what I do currently with MS-DOS.
My files are created in a folder A
They are moved by on a folder B
The credentials for the winscp connection are passed into %fic_send%
Then a forfiles command is called for each files
Forfiles -p %chemin_moved% -m *.xml -c "cmd /c echo put @path>>%fic_send%"
The generated file is called, all the files are transferred.
call sftp_sendfiles.bat
A move is done from folder B to a final folder C
move %chemin_moved%\*.xml %chemin_to%\transferred>>%fic_log%
It works well everyday. But, sometimes I got error during the FTP transfer, and all my files are moved into final folder C even if they are not transferred.
How can I modify my code to stop the process if a file failed to be transferred ?
I tried with if %ERRORLEVEL% neq 0 goto error
But as I wrote this in a file, %errorlevel% was replaced by a 0 (correct, but not what I wanted !)
Just to let you know I'm not familiar at all with MS-DOS.
Thanks
Here is what I do currently with MS-DOS.
My files are created in a folder A
They are moved by on a folder B
The credentials for the winscp connection are passed into %fic_send%
Then a forfiles command is called for each files
Forfiles -p %chemin_moved% -m *.xml -c "cmd /c echo put @path>>%fic_send%"
The generated file is called, all the files are transferred.
call sftp_sendfiles.bat
A move is done from folder B to a final folder C
move %chemin_moved%\*.xml %chemin_to%\transferred>>%fic_log%
It works well everyday. But, sometimes I got error during the FTP transfer, and all my files are moved into final folder C even if they are not transferred.
How can I modify my code to stop the process if a file failed to be transferred ?
I tried with if %ERRORLEVEL% neq 0 goto error
But as I wrote this in a file, %errorlevel% was replaced by a 0 (correct, but not what I wanted !)
Just to let you know I'm not familiar at all with MS-DOS.
Thanks