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 8700329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:08:58+00:00 2026-06-13T02:08:58+00:00

I have a question about how can I change some files names. The problem

  • 0

I have a question about how can I change some files names. The problem is I have this kind of archives, for example:

25614_z.zip
25312_z.zip
25003_z.zip

And I want to create that:

lp_25_614.zip
lp_25_312.zip
lp_25_003.zip

So, I need to automatize this process

lp + 25 (the two first digits) + the number in the 3 4 and 5 position) + dot zip

Is there any way to do it?

EDIT

For example, this would be my condition:

XXXX

if fileNames{k}(3:5) >0 <5 (the interval)= 2
fileNames{k}(3:5)> >5 >10 =10

So, for example:

fileNames{k}(3:5) = 05

after the condition it would be replaced in the rename with= 2

And then I want to add it on the rename name.

newFileName = ['fiche' fileNames{k} (3) 'pd' fileNames{k}(3:5) 'XXX '.tar.gz']; 

Is that possible?

  • 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-13T02:08:59+00:00Added an answer on June 13, 2026 at 2:08 am

    You can use movefile to rename the files:

     myPath = 'C:\myFolder\'; % path to your files
    
    fileNames = {
        '25614_z.zip'
        '25312_z.zip'
        '25003_z.zip'
        }
    
    
    for k = 1:length(fileNames)
        newFileName = ['lp_' fileNames{k}(1:2) '_' fileNames{k}(3:5) '.zip'];
        % renaming
        movefile([myPath fileNames{k}], [myPath newFileName]); 
    end
    

    ~edit~
    Concerning your edit: yes it is possible to generate the file name different for separate cases. Note that the example below is quite clumsy and should only be used if you have only a small number of different cases.

    myPath = 'C:\myFolder\'; % path to your files
    
    fileNames = {
        '25614_z.zip'
        '25312_z.zip'
        '25003_z.zip'
        }
    
    
    for k = 1:length(fileNames)
        n = num2str(fileNames{k}(3:5));
        if n > 0 && n < 5
            fileName = % put your file name for this case here
        elseif n >= 5 && n < 10
            fileName = % put your file name for this case here
        elseif n >= 10 && n < 20
            fileName = % put your file name for this case here
        end
        % renaming
        movefile([myPath fileNames{k}], [myPath newFileName]);
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about a problem I'm struggling with. Hope you can bear
So, i have some question about xml Documents in Java. Can i get all
I have the following question about JPA: Can I save the order of the
I have a question about JSF and GET http request. How can I get
I have a question about joptionpane. Using JOptionPane.showMessageDialog(...), we can create a message dialog.
Can anyone help me with a question about webservices and scalability? I have written
This is something I have been struggling about for some time now. The thing
I have questions about System.Threading.ThreadStart Class : where can I find its specifications (
I have question about parsing in Html helper : I have sth like: @foreach
I have question about clean thory in Python. When: @decorator_func def func(bla, alba): pass

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.