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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:36:40+00:00 2026-06-04T15:36:40+00:00

I have over 700 files in one folder named as: files from number 1

  • 0

I have over 700 files in one folder named as:
files from number 1 to number9 are named for the first month:

water_200101_01.img  
water_200101_09.img  

files from number 10 to number30 are named:

water_200101_10.img
water_200101_30.img

And so on for the second month:
files from number 1 to number9 are named:

water_200102_01.img  
water_200102_09.img  

files from number 10 to number30 are named:

water_200102_10.img
water_200102_30.img 

How can I rename them without making any changes to the files. just change the nams, for example

water_1
water_2
...till...
water_700
  • 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-04T15:36:41+00:00Added an answer on June 4, 2026 at 3:36 pm

    file.rename will rename files, and it can take a vector of both from and to names.

    So something like:

    file.rename(list.files(pattern="water_*.img"), paste0("water_", 1:700))
    

    might work.

    If care about the order specifically, you could either sort the list of files that currently exist, or if they follow a particular pattern, just create the vector of filenames directly (although I note that 700 is not a multiple of 30).

    I will set aside the question, “why would you want to?” since you seem to be throwing away information in the filename, but presumably that information is contained elsewhere as well.

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

Sidebar

Related Questions

I have over a thousand folders, each folder contains one or more files with
I have taken over some code from a previous developer and have come across
I have over 5 million session files in /var/lib/php5 I would like to delete
I have over a million text files compressed into 40 zip files. I also
I have over 300k records in one collection in Mongo. When I run this
I have over 30,000 pdf files. Some files are already OCR and some are
Suppose I have over 100 files called in via require_once() command. Is this inducing
I have over 125 TSV files of ~100Mb each that I want to merge.
I have over 150 sounds in my raw folder and it has become quite
We have over 1000 unit tests. A while ago 18 of them started to

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.