Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7794833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T22:53:27+00:00 2026-06-01T22:53:27+00:00

i would like to trim file names in batch for eg: From This IsGood

  • 0

i would like to trim file names in batch for eg: From “This IsGood 1.1.png” To “tig11.png”

The condition is that the script should get all capitalized letter from the file name,convert them into small letters and then form the trimmed file name without any spaces in it…

Please me help accomplishing this task..
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T22:53:29+00:00Added an answer on June 1, 2026 at 10:53 pm

    you may begin with a simple iteration on the filename

    set str=This IsGood 1.1
    :again
    set chr=%str:~0,1%
    set str=%str:~1%
    if not  "%chr%"=="" echo %chr% 
    if not "%str%"=="" goto :again
    

    read HELP SET, HELP IF and HELP GOTO

    Now, if understood, proceed by changing the echo command into a call…

     if not  "%chr%"=="" call :checkchar %chr% 
     ...
     :checkchar 
     echo %1
     goto :eof
    

    read HELP CALL

    then implement the actual code for checking if the character is uppercase or not

    :checkchar 
    for %%c in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9) do if .%1==.%%c echo %%1
    goto :eof
    

    read HELP FOR

    change now this new echo command into a new call to a function to set the variable to lowercase

    now concatenate the result into a, say, fn variable that you will need to initialize to blanks.

    and wrap all with the appropiate filename handling, extracting just the filename (see the ~n option in the syntax of handling parameters) and then composing back the full path with the new name (using the ~d ~p ~x options)

    @echo off
    set fn=
    call :upcaseonly %~n1
    echo %~dp1%fn%%~x1
    goto :eof
    
    :upcaseonly
    set str=%*
    :again
    set chr=%str:~0,1%
    set str=%str:~1%
    if not  "%chr%"=="" call :checkchar %chr% 
    if not "%str%"=="" goto :again
    goto :eof
    
    :checkchar
    for %%c in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9) do if .%1==.%%c set fn=%fn%%1
    goto :eof 
    

    use this as a starting point. you will have to add your own logic for renaming the file and handling if the file already exists or if the file cannot be renamed …

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a large raw data file that we would like to trim to
I would like to trim a beginning and ending double quote () from a
Would like to parse IPv4 address from exit-addresses . Format of the file: ExitNode
I would like to read each line of text from the file outputted from
I have a file log that I would like to parse and am having
I would like to trim a \ character from the end of the string.
I have a logging script which saves to file logs. I would like to
My string looks like this $string_value = /hello/world/this/feels/great/ how can I trim world and
Would like a for loop in jquery so that: For every hover_link: show hidden
Would like someone to take a look at my script and tell me where

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.