0

I need to create an ftp script to from a file list. To create the script to from this list, I need to use the FOR command, but I do not know to use.

List of files is called "verifica.txt" and within it have the lines:

C:\xml\UPLOAD\35150650956911000165550550000198041000464010.doc
C:\xml\UPLOAD\35150650956911000165550550000198051000463983.doc
C:\xml\UPLOAD\35150650956911000165550550000198061000463999.doc
C:\xml\UPLOAD\35150650956911000165550550000198071000464003.doc
C:\xml\UPLOAD\35150650956911000165550550000198081000464027.doc

I am not able to make my script leave the right way. In this code I'm trying to generate my FTP script to put

echo in10xml> upload_files_xml.ftp
echo xml_in10 >> upload_files_xml.ftp
for / f% i in (verifica.txt) echo put% i / content / UPLOAD /% i >> upload_files_xml.ftp
echo bye >> upload_files_xml.ftp

When you run the command FOR above him to give me the result below:

user
password
put C:\xml\UPLOAD\35150650956911000165550550000198041000464010.doc /content/UPLOAD/C:\xml\UPLOAD\35150650956911000165550550000198041000464010.doc
bye

The need FOR generate the result as follows:

user
password
put C:\xml\UPLOAD\35150650956911000165550550000198041000464010.doc /content/UPLOAD/35150650956911000165550550000198041000464010.doc
bye
2
  • 1
    Your for statement is wrong. Type for /? at a command prompt and see how the /f argument works. And unless you've transported yourself back to the 1990's, this isn't MS-DOS. It's a Windows command prompt. Commented Sep 28, 2016 at 12:48
  • Please insert your code correctly; when you run it as stated, there is no output to the .ftp file , and the error message / was unexpected at this time.! Commented Sep 28, 2016 at 17:17

1 Answer 1

1

Try this:

(echo in10xml
    echo xml_in10
    for /f %i in (verifica.txt) echo put %i /content/UPLOAD/%~nxi
    echo bye)> upload_files_xml.ftp
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.