Re: Filename changes
- From: "Rick Rothstein [MVP - Visual Basic]" <rickNOSPAMnews@xxxxxxxxxxxxxxxxx>
- Date: Wed, 31 Aug 2005 10:17:20 -0400
> My scanner auto saves filenames with an auto incrementing number on
the end.
> I can specify a filename, and the software appends 0001, 0002 etc onto
each
> successive scanned document. I've now accumulated dozens, if not
hundreds of
> files with this extension, spread across several directories and
> sub-directories.
>
> I would like to write a script to rename the files within the
directory
> structure to remove the 000 and replace it with a space, and where the
> accumulation of documents has exceeded 10, rename files 0010 etc so
that the
> "00" is replaced by a space.
>
> Basically, I need to do a VB script to rename filename0001.tif through
to
> filename0010.tif etc. I'd like to run the script on the main directory
and
> have it take case of the contents of all its subdirectories
>
> I'm struggling to find information on the web to help me here. I can
find
> file rename scripts, but not details on how to remove characters from
a
> filename. I'd like to replace "000" with a space if possible.
If you are really using VB Script, then, as Jeff posted, you will want
to ask your question(s) in the
microsoft.public.scripting.vbscript
newsgroup. However, I'm thinking that after you find out how to visit
the files in the directories and sub-directories using VBScript, you
will end up using code similar to the following to physically change the
filenames as you require.
OldFileName = "FileName0100.tif"
Dot = InStr(OldFileName, ".")
Ext = Mid(OldFileName, Dot)
Number = CStr(Val(Mid(OldFileName, Dot - 4, 4)))
BaseName = Left(OldFileName, Dot - 5)
NewFileName = BaseName & " " & Number & Ext
Rick
.
- References:
- Filename changes
- From: John
- Filename changes
- Prev by Date: Re: Gui freeze
- Next by Date: Re: Classes With a Form
- Previous by thread: Re: Filename changes
- Next by thread: Gui freeze
- Index(es):
Relevant Pages
|
Loading