Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I want to create a file to do the following:
1. Create multiple copies of a folder and rename them in a numerically ascending order.
2. Open a specific file from the folder and change some of the contents.
3. save the changed file.
4. repeat actions 2 and 3 for all the copies. However, the changes in their individual files will be different for each folder.I think i can do the first step. However, i cant find a command to find and Replace the text in a file.
I can use the findstr "string" path:filename cmd to find the required string, but how do i replace it?

No obvious way with the "tools" provided by DOS / XP.
I think you're stuck with 3rd party utils.
M2
If at first you don't succeed, you're about average.

1 - You cannot create multiple copies of a folder unless there in different folders. Your best method is to create the folders in one folder then copy the files. i.e.
md dir01
md diro2
md dir03
...
md dirnn
copy dirxx\*.* dir01
copy dirxx\*.* dir02
copy dirxx\*.* dir03
...
copy dirxx\*.* dirnn2,3,4 To open, replace, save will require 3rd party software unless the contents is simple enough that it could be created by other means.

Hi,
Thanks for your responses guys.
I can find text and write the changes back to the original file using the FOR command.
but is there a way to delete a particular line in the file?
m looking into 3rd party tools.

As to removing lines, assuming it's a text file, you can:
find /v "string" < file > newfile
which will put all the lines NOT containing the string into newdile.
***
The two 3rd party changers I use are:The change.com will work on files up to about 32KB. For bigger ones you need the EXE.
The EXE version has complete docs. I you decide to use the COM ver, ask for syntax help.
M2
If at first you don't succeed, you're about average.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |