使用文件名列表创建文件并向每个文件添加内容
我需要制作一堆重定向页面,因为我最近更新了我的网站,该网站以前使用 .html 文件,现在所有文件都是 .aspx。 我有一个制表符分隔的文件,其中包含原始文件名列表和相应的新文件名。
似乎应该有一种语言,我应该能够使用第一列作为文件名创建一个文件,并插入第二列作为其内容以及一些用于 301 重定向的附加文本。
有人可以为我指出正确的方向,即哪种语言能够实现这一目标吗? 另外,如果您还可以指出我将使用的方法/函数的名称,这样我就知道创建文件时从哪里开始。
我需要多次做此类事情,并且愿意学习一门新语言(Perl、Python 或其他语言)来完成此任务,但我只需要指明正确的方向。 我使用Windows XP进行开发。
感谢您的时间。
I need to make a bunch of redirect pages as I've recently updated my web site which previously used .html files and now all the files are .aspx. I have a tab-delimited file containing a list of original filenames and the corresponding new filename.
It seems like there should be a language out there that I should be able to create a file using the first column for the filename and insert the second column as its content with some additional text for the 301 redirect.
Could someone point me in the right direction as to what language(s) would be able to accomplish this? Also, if you could also point out the name of the method/function I would be using so I know where to begin when creating the file.
I've needed to do this type of thing many times and am willing to learn a new language (Perl, Python, or whatever) to accomplish this, but I just need pointed in the right direction. I am using Windows XP to develop on.
Thank you for your time.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您已经在使用 aspx,则可以通过几行 C# 来完成此操作,您可以在虚拟页面的代码隐藏中对其进行处理。
This can be done in a few lines of C# if you already are working with aspx you can process this in the codebehind on a dummy page.