Re: Creating a script to search and replace files in XP
- From: "Pegasus \(MVP\)" <I.can@xxxxxxx>
- Date: Wed, 14 Feb 2007 07:16:16 +1100
"Pegasus (MVP)" <I.can@xxxxxxx> wrote in message
news:OXktTryTHHA.5068@xxxxxxxxxxxxxxxxxxxxxxx
is
<arin.speed@xxxxxxxxx> wrote in message
news:1171306072.626043.131430@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thanks for your reply. Sorry for the paucity of information, you
forget that people don't automatically know what you are talking about
after working on the same thing for ages:
1. The files are uniquely named, each containing the nomenclature
"OMSH-2006" in the file name.
2. Conversely, the new files to be produced will be named
"OMSH-2007."
3. The aim is simply to remove the files from the active server. To
that end, they don't need to be deleted, instead they could just be
moved into a new folder that would then be archived. I thought that
deleting them would be a simpler mechanism though.
Apologies if this is not sufficient - I'm don't mean to make this a
tedious affair.
Thanks again,
Arin
Pegasus (MVP) wrote:
<arin.speed@xxxxxxxxx> wrote in message
news:1171261719.711955.318910@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,
I'm in charge of searching for and replacing a group of older files
with their updated equivalents. We have a program that will convert
the older files into the current standard. What I am trying to do
thecreate a script that will search through the vast amount of folder/
subfolders that we have, call the conversion software and convert
deletingfile, and then delete the old file. So far, I haven't had much luck
with the Microsoft website. Any suggestions would be appreciated.
Thanks,
Arin
You probably need a batch file. However, with the small amount
of information you have supplied so far, it is not possible to give
you a good answer. Here are a few pertinent questions:
- How does the script know which file(s) to convert?
- How does the script know if the file is unconverted?
- Would it not be prudent to rename the old version instead of
it?
Try the batch file below. You must specify your converter program
and syntax in the second line from the bottom. Remove the word "echo"
from the last two lines to activate the batch file.
That's because I failed to paste it into my reply. Sorry!
@echo off
set wd=e:\drivers
set OldPattern=OMSH-2006
set NewPattern=OMSH-2007
cd /d "%wd%
dir /s /b | find "%OldPattern%" > c:\Files.tmp
for /F "tokens=*" %%* in ('type c:\Files.tmp') do call :Sub %%*
del c:\Files.tmp
goto :eof
:Sub
set old=%*
call set new=%%old:%OldPattern%=%NewPattern%%%
echo c:\Tools\Convert "%old%" "%new%"
echo del "%old%
.
- References:
- Creating a script to search and replace files in XP
- From: arin . speed
- Re: Creating a script to search and replace files in XP
- From: Pegasus \(MVP\)
- Re: Creating a script to search and replace files in XP
- From: arin . speed
- Re: Creating a script to search and replace files in XP
- From: Pegasus \(MVP\)
- Creating a script to search and replace files in XP
- Prev by Date: Re: Modified date
- Next by Date: Re: Modified date
- Previous by thread: Re: Creating a script to search and replace files in XP
- Next by thread: File Copy/Move Order
- Index(es):
Relevant Pages
|
Loading