Hi all,
I am regularly updating files to my website www.vorticity.de - meteorological data.
Procedure: files are regularly overwritten by files with identical name, but new data.
Problem: Due to any Proxy or cache, only overwriting files does not guarantee that files with
new data are delivered to any browser call - deleting old files before uploading new files helps!
Solution: Delete files file1.jpg file2.jpg ... before uploading file1.jpg file2.jpg ... using ftp del
My problem: writing file1.jpg file2.jpg ... into a file for the ftp_delete_script is easy...
> but how can I put 'del ' as leading string of each line with a filename ?
Should be easy and I am sure, some of you know better and smarter than me by guessing...!
Thanks for any constructive help!
To repeat in short: I create a file D:\FTP\xftp_upload.cmd to delete existing files as follows
ftp -s:d:\FTP\xftp_upload.txt
The file xftp_upload.txt should look as follows
open ftp.vorticity.de
user
password
del file1.jpg
del file2.jpg
del file3.jpg
The problem is how to write the leading string 'del ' before each line of the file,
the filenames are easy using dir > xftp_upload.txt
Any help more than welcome!
Regards, Bernd.
How to add 'del ' as leading sttring of all lines of a file ?
Moderator: DosItHelp
-
- Posts: 239
- Joined: 04 Mar 2014 11:14
- Location: germany
-
- Expert
- Posts: 1163
- Joined: 06 Sep 2013 21:28
- Location: Virginia, United States
Re: How to add 'del ' as leading sttring of all lines of a file ?
Do you want to delete all of the files in the directory you're uploading to, or just the ones with the same filename? The FTP command mdel *.jpg will delete all of the JPG files from the target directory on the FT P server.
Otherwise, you can use dir in a for loop, like this:
Otherwise, you can use dir in a for loop, like this:
Code: Select all
for /f "delims=" %%A in ('dir /b') do echo del %%A >>xftp_upload.txt