Cynosure.X International

:

Add Comment | Related Links | TrackBack
Related Content

SubStringRename (Freeware)

SubStringRename is a command-line Java software that will search for a particular string in a file name and replace it with another string. This software understands standard file specification masks, so you can execute it on a number of files at once. Because SubStringRename is written as a command-line utility, it can be used in custom batch files and custom scripts. SubStringRename is written in Java, so it will run on any Java-supported operating system.

SubStringRename takes advantage of the CI Class Package 5.4 or newer. You will have to download the package and install it if you don't have it already.

SubStringRename is distributed as Freeware. Please see the "Freeware License Agreement" elsewhere on this site.

Usage

  java SubStringRename "srch str" "repl str" "file 1" [ ... "file n" ] 

Example 1

Substituting the "dscn" prefix with "pict" in all jpg files:

  java SubStringRename "dscn" "pict" *.jpg 

Result:

dscn0038.jpg -> pict0038.jpg
dscn0039.jpg -> pict0039.jpg
dscn0040.jpg -> pict0040.jpg
dscn0041.jpg -> pict0041.jpg
dscn0042.jpg -> pict0042.jpg
dscn0043.jpg -> pict0043.jpg
dscn0044.jpg -> pict0044.jpg
dscn0045.jpg -> pict0045.jpg

Example 2

Changing file name extension from "txt" to "html":

  java SubStringRename "txt" "html" *.txt 

Result:

19980206_0042.txt -> 19980206_0042.html
19980206_0856.txt -> 19980206_0856.html
19980225_1257.txt -> 19980225_1257.html
19980225_1343.txt -> 19980225_1343.html
19980310_1245.txt -> 19980310_1245.html
19980330_1401.txt -> 19980330_1401.html
19980330_1437.txt -> 19980330_1437.html
19980330_1456.txt -> 19980330_1456.html
19980330_1637.txt -> 19980330_1637.html

Attached File: SubStringRename.class

Chieh Cheng
Mon, 6 Feb 2006 09:42:54 -0800

Made bug fixes and improvements to the SubStringRename Java class. In this release, this utility now supports:

1) Directory specification as part of the file specification.
2) Windows UNC path.
3) Checks that search and replace strings are not the same.

The following example shows what you can do now. The new version is attached below.

Example 3

Substituting the "dscn" prefix with "pict" in all jpg files within the "\\server\transfer" directory:

  java SubStringRename "dscn" "pict" "\\server\transfer\*.jpg"

Result:

  \\server\transfer\dscn0038.jpg -> pict0038.jpg
\\server\transfer\dscn0039.jpg -> pict0039.jpg
\\server\transfer\dscn0040.jpg -> pict0040.jpg
\\server\transfer\dscn0041.jpg -> pict0041.jpg
\\server\transfer\dscn0042.jpg -> pict0042.jpg
\\server\transfer\dscn0043.jpg -> pict0043.jpg
\\server\transfer\dscn0044.jpg -> pict0044.jpg
\\server\transfer\dscn0045.jpg -> pict0045.jpg

Attached File: 1 - SubStringRename.class (3 KB)

Chieh Cheng
Fri, 29 Apr 2016 12:53:32 +0400

Add Comment | Related Links | TrackBack
Related Content

Did your message disappear? Read the Forums FAQ.

Add Comment

Spam Control | * indicates required field
Your Name: *
E-mail:
Remember Me!
Comment: *
File attachment is optional. Please do not attach a file to your submission unless it is relevent.
Attach File:
(20 MB Max)
Spam Protection: * Answer of 0 - 7?
Click button only once, please!

TrackBack

Send Ping | TrackBack URL | Spam Control

No TrackBacks yet. TrackBack can be used to link this thread to your weblog, or link your weblog to this thread. In addition, TrackBack can be used as a form of remote commenting. Rather than posting the comment directly on this thread, you can posts it on your own weblog. Then have your weblog sends a TrackBack ping to the TrackBack URL, so that your post would show up here.

Messages, files, and images copyright by respective owners.

Products | Services
Forums | Latest | RSS
Library | Search | Wiki
Help | Licenses

Login | Register

14 Users Online

Hacking Digital Cameras
Fun for Photographers


Amazon Associate

Copyright © 1996 - 2017. All Rights Reserved.