Re: Filename changes



> 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


.



Relevant Pages

  • Filename changes
    ... 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 ... I would like to write a script to rename the files within the directory ... I need to do a VB script to rename filename0001.tif through to ...
    (microsoft.public.vb.general.discussion)
  • Re: renaming windows mp3 files
    ... These files have spaces and - characters in their names. ... You could either rename before starting via a script, ... depending on how you build your list of "to do" filenames. ...
    (comp.unix.shell)
  • Re: Filename changes
    ... Rick, this code looks good, thanks for setting it ... I'll try to do the script myself, then post to the group you ... >> accumulation of documents has exceeded 10, rename files 0010 etc so ... > filenames as you require. ...
    (microsoft.public.vb.general.discussion)
  • spaces to underscores
    ... I strongly dislike spaces in filenames and wish to have a script which ... will rename a file changing spaces to underscores. ... I'd like to ask for advice on how I could rename a file ...
    (comp.unix.shell)
  • Re: spaces to underscores
    ... I strongly dislike spaces in filenames and wish to have a script which ... will rename a file changing spaces to underscores. ... I'd like to ask for advice on how I could rename a file ...
    (comp.unix.shell)

Loading