2022 Developer Survey is open! Take survey.

Questions tagged [rename]

The rename tag refers to the action of giving a different name to either an existing file or to a copy of a file as part of some other operations (.e.g. remote copy, backup). Use this tag as well for questions related to the (perl) rename command.

Filter by
Sorted by
Tagged with
1 vote
2 answers
27 views

Rename files with numbers already in file name

I have files with following names starting with water-frames0.gro upto water-frames201.gro water-frames0.gro water-frames119.gro water-frames138.gro water-frames157.gro water-frames116.gro water-...
user avatar
  • 113
0 votes
0 answers
25 views

Command for bulk renaming of a fixed file extension in a folder and its subfolders

Complete Linux noob here. I'm just trying to find a script that changes all *.TIFF in a folder (/volume1/home) and its subfolders into .ARW. I'm running it on my Synology so a one line command that I ...
user avatar
0 votes
1 answer
24 views

How to recursively change names of files to match?

I'm trying to change the names of multiple files recursively within a directory, looking something like this: parentdirectory/dir1/foo_1.txt /dir2/bar_1.txt /dir3/foo_2....
user avatar
0 votes
1 answer
37 views

Why are neither rename nor mmv working on my Fedora 35 system?

On my Fedora 35 system neither of the following are working. I have about twenty or so jpg files in a directory, and I wish to add the name of a website to each image after its main title. I am ...
user avatar
  • 109
0 votes
0 answers
30 views

Rename command in Ubuntu: change character after date only when date at the beginning of the filename

For example this example with a date (my dates change, but they have always the format YYYY-MM-DD) and a trailing -: 2022-04-28-examplename-some-more-text-2022-04-28-more-text.txt should become the ...
user avatar
  • 1
0 votes
2 answers
42 views

Remove particular words from filenames

I have a file named [ NarutoG] Naruto - 084 Roar, Chidori! Brother vs. Brother! [720p] [x265] [pseudo].mkv I want to change it to Naruto - 084 Roar, Chidori! Brother vs. Brother!.mkv I have ...
user avatar
1 vote
0 answers
31 views

renaming wireless interface

I know I can rename my wireless interface with ip link set name , but when I do other programs won't identify the new name, namely wash, and then if I run iwconfig down I can't get systemctl won't ...
user avatar
1 vote
2 answers
57 views

Batch renaming file names including a part of old file name

I have a following list of files; 11F.fastq.gz 11R.fastq.gz 12F.fastq.gz 12R.fastq.gz I'd like to rename these file names to the following; 11_S11_L001_R1_001.fastq.gz 11_S11_L001_R2_001.fastq.gz ...
user avatar
  • 113
1 vote
1 answer
124 views

How to bulk rename files/directories containing spaces?

How can you bulk rename many files and/or directories by replacing a snippet f o o with b a r in the file/directory name? For each suggested method, preferably answer the following questions. Is it ...
user avatar
  • 153
5 votes
8 answers
916 views

Rename file by moving middle string to end of the filename

I have some data files and I wish to rename them for my pipeline. The files look like this: {unique_ids}_{experiment_condition}_L{3_digit_number}.txt I need to rename them so the experiment condition ...
user avatar
  • 53
0 votes
1 answer
52 views

How to convert file names using Bash/terminal

I have a bunch of files. academic-cap.svg arrow-narrow-right.svg ban.svg chart-bar.svg adjustments.svg arrow-narrow-up.svg beaker.svg chart-pie....
user avatar
  • 599
3 votes
2 answers
101 views

Rename file with the rename tool - moving around square brackets

Rookie question. Following this answer Move last part of filename to front, I'm trying to do the same, except all files in my case contains square brackets. What I want is to move the title to the ...
user avatar
2 votes
5 answers
499 views

Renaming files using regex

I have a number of files in a folder on a Linux machine with the following names: 11, 12, 13, 14, 15, 21, 22, 23, 24, 25, 31, 32, 33, 34, 35 I would like to use regex in order to rename with the .inp ...
user avatar
  • 123
1 vote
3 answers
77 views

Can one do the equivalent of "rm -rf targetdir && mv sourcedir targetdir" with one command?

There are a few ways to interpret the operation of "replacing one file with another", but the one I want to focus on here is the one that can be achieved with the command mv /that/there/...
user avatar
  • 12.8k
7 votes
2 answers
787 views

Simplifying complicated music file names

I have a large directory of music files whose titles follow the below format: Title_stringOfNumbers - Artist.mp3 My goal is to remove the underscores followed by numbers and switch the artist's name ...
user avatar
0 votes
2 answers
33 views

How do I get a handle on a file renamed with regex?

I'm renaming a file with regex ... f='/path/to/file' rename 's/(^.*)([ab])(.*)([cd])(.*$)/$1$4$3$2$5/s' "$f" How do I then get a handle on the renamed file so I can process it given I don't ...
user avatar
  • 392
3 votes
1 answer
80 views

Best way to remove and replace different characters from multiple filenames?

I have several folders full of files with the following format: Show Name - 07x09 - Episode Title.mp4 What I'm trying to do is rename them to the following format: Show.Name.S07E09.Episode.Title.mp4 ...
user avatar
0 votes
2 answers
103 views

Renaming all files in the current directory to names listed in a text file

The original title was: Injecting vidir with vim like sequence of commands I have been trying to use vidir to rename multiple files which are accidently renamed by someone. Problem is vidir doesnt use ...
user avatar
0 votes
1 answer
55 views

How to Rename middle part of multiple files [duplicate]

I have some numeric files like: test01-aaa.txt test02-bbb.txt test03-ccc.txt test04-ddd.txt I need to remove aaa,bbb,ccc,ddd part from the name. what is the best way i can do? I tried with 'rename' ...
user avatar
0 votes
1 answer
39 views

Rename a single file whose ending is unknown

Imagine I have this file in a certain directory chromedriver_97.0.4692.71 By default I don't know the ending after _ (I download it from the web, and this is for a script), and I want to rename it to ...
user avatar
4 votes
4 answers
293 views

Remove regex from filenames, while piping them

I'm converting a bash of files from iso-latin-1 (aka, iso-8859-1) to utf-8. In this process, I have the opportunity to rename the files. And, I would like to seize this opportunity to change the error-...
user avatar
  • 143
1 vote
1 answer
375 views

How to use sed to replace multiple strings with the same pattern in a file

I am trying to use the sed command to modify a file. The original file has 5 chromosomes, which named "1 CHROMOSOME", "2 CHROMOSOME", "3 CHROMOSOME", "4 CHROMOSOME&...
user avatar
  • 15
2 votes
4 answers
246 views

Rename a bunch of file by replacing a number in the filename by a coresponding string from a textfile

I have a large number of files I want to rename. Each filename contains a number (xxx): FIXED_PART_xxx_UNIQUE_PART. I also have a text file, which has a number and a string in each line: 001 string001 ...
user avatar
  • 23
1 vote
1 answer
83 views

Why rename simply doesn't work?

I need to rename multiple files, and some tutorials shows that the command rename is the best option instead of just use mv for each file. But then I have these files: ReconhecimentoImagens2021-10-18-...
user avatar
  • 13
0 votes
3 answers
69 views

Change number written in scientific notation in filenames

I'm going to make a video of image files, but the filenames contain numbers in scientific notation, so the ordering of the name will not be correct. The filenames are in this format: ABC_1.000000E-01....
user avatar
0 votes
0 answers
32 views

djvu file renaming based on metadata tags

I have a disk of engineering drawings and manuals in .djvu format. Unfortunately each file is named a0001.djvu, a00002.djvu. There are several thousand of these and I'd like to rename them based on ...
user avatar
-1 votes
2 answers
50 views

Remove date from movie filenames recursively without using rename

I have a directory "Movies" with individual directories like, "Gone with the Wind" and filenames like, "Gone with the Wind (1939).mp4 I want to rename them, removing the "...
user avatar
0 votes
1 answer
74 views

Changing part of the name of many files to unique names, using a spreadsheet of names

I need some help. I want to rename very many files with unique filenames using bash. I want to keep part of the original filename. For example: current file name new file name F1.R23.fastq.gz 10_1....
user avatar
  • 1
3 votes
3 answers
398 views

how to recursively remove embedded carriage return in filenames

Is there a way to recursively remove a carriage return \r character that has been appended to thousands file names across a hierarchy of dozens of folders? Also, not all files were affected. For ...
user avatar
1 vote
0 answers
42 views

Can't move or rename folder in git repo, permission denied, despite being 'drwxrwxrwx', and bareword [duplicate]

I'm using Windows Subsystem for Linux 1 (WSL1), I want to rename the folder my code downloads files to from 'resources' to 'downloads' so I can group my files that do the downloading under a '...
user avatar
6 votes
4 answers
386 views

Replacing counter in a filename for all files in a directory

After importing several 1000 Files from a camera onto a hard drive I realized, that the counter, used in the process of renaming the file - does not start from 0. This leads to file structure like ...
user avatar
  • 171
1 vote
2 answers
125 views

How do you rename multiple files by removing 4 characters in the middle that are different in each file name but in the same location? [duplicate]

I would like to rename my files using Bash by removing 4 characters in the middle. Original file names: dwe_hiul123456.pdf dwe_lkyd345876.pdf dwe_ythn157843.pdf I want to remove the 4 letters in the ...
user avatar
  • 13
3 votes
1 answer
244 views

How to remove underscore between two numbers in all files in a directory

So I have a directory with nested folders, and at some point there are .png images. The naming of these images is like this "letters_numbers_numbers_letters.png", and I want to delete the ...
user avatar
3 votes
2 answers
173 views

Rename file sets with multiple (incl. compounded) extensions in shell

I have a list of file sets with a lot of extensions, but unique names. filename-1.foo.001 ... filename-1.foo.020 filename-1.foo.baz filename-1.foo.bar1-2.baz ... filename-1.foo.bar7-8.baz ...
user avatar
  • 77
0 votes
1 answer
32 views

Rename Files within multiple directories based on partial directory names

I have many directories in a location with files of various extensions within them. The directories follow a standard convention but the files within do not. The solution I'm trying to come to is to ...
user avatar
3 votes
2 answers
376 views

How to rename multiple files by changing one component of the file name?

I found lots of questions about how to rename multiple files using the command line. However I am not able to solve my specific issue which is renaming this file name: ...
user avatar
  • 371
1 vote
3 answers
49 views

Rename file by removing repetitive substrings contained in filenames

I need to rename a bunch of files with the following pattern: sub-2795479_ses-V1_task-rest_acq-REST1_dir-AP_run-01_run-01_run-01_run-01_run-01_run-01_run-01_run-01_run-01_run-01_run-01_run-01_run-...
user avatar
0 votes
1 answer
32 views

how to mv/rename multiple files by adding current date on files names

I need to adapt a bash script on Red Hat that mv/renames multiple files and adds current date on their names. For example, I have bulk of files below: PBSS4C.SASS.CCAC.I101010.P211008 PBSS4C.SASS....
user avatar
0 votes
1 answer
44 views

I specifically need to remove the fifth character from linux filenames using 'rename'

I've been going round in circles! I specifically need to remove the fifth character from filenames using 'rename' in Kubuntu linux. That character appears elsewhere in the names so searching for the ...
user avatar
-1 votes
1 answer
51 views

Rename 2 files using shell script

I created a script called rename_2_files.sh: #!/bin/sh #_start while getopts o: flag do case "${flag}" in o) OPTION=${OPTARG};; esac done # declare variable RENAME ="rename&...
user avatar
0 votes
3 answers
359 views

How to create a patch for renaming a file

Suppose I have a file (myfile.txt) containing this text: The quick brown fox jumps over the lazy dog. I rename this file from myfile.txt to mystory.txt. How do I create a diff that represents this ...
user avatar
  • 1,832
0 votes
3 answers
83 views

Filename modification

Lets say I have 1000 files named as file1.txt ... file1000.txt I need to change the file name if the number is divisible by 10. I did this and it just change the first letter for f in *.txt; do mv -- ...
user avatar
2 votes
1 answer
40 views

How to move multiple files starting with different strings/names to different folder?

The scenario is I have a bunch of files: peter1.json peter2.json peter3.json peter4.json tom1.json tom2.json tom3.json tom4.json jane1.json jane2.json jane3.json jane4.json plus various other files I ...
user avatar
  • 123
0 votes
1 answer
27 views

Rename odbc.ini file

Can you please let me know how can I replace the name from odbc.ini (old name) to .odbc.ini (new name) in putty using Linux commands?
user avatar
0 votes
1 answer
82 views

Renaming the files and folders using text files

I am trying to rename the files and directories using a text file separated by space. The files.txt looks like this: dir1-1 dir1_1 dir2-1 dir223_1 My command is as follows: xargs -r -a **files.txt** -...
user avatar
  • 1
0 votes
0 answers
20 views

Linux - Moved odbc.ini file from home directory

I wanted to rename my odbc.ini(old name) file name to .odbc.ini (new name). I used mv odbc.ini .odbc.ini command in the same directory. However,accidentally it got deleted from my homefolder.I want to ...
user avatar
0 votes
2 answers
65 views

How can I remove certain word from filename?

I have files in the following directory: import/images Documents\ProductImages\1.jpg Documents\ProductImages\2.jpg Documents\ProductImages\3.jpg how can remove Documents\ProductImages\ from filenames?...
user avatar
  • 1
0 votes
1 answer
40 views

Renaming multiple files that contain different numbers

I have multiple files that have the following format: (note that file corresponds to each file name which is not common). File1_S20.tab File2_S25.tab File3_S40.tab etc. I want to rename them all so ...
user avatar
  • 13
0 votes
2 answers
78 views

img2pdf: get pages in good order

img2pdf works very quickly with hundreds of images and creates a pdf out of them with a command like img2pdf *.tif -o out.pdf but the page order is wrong in my case. I ran the command in konsole ...
user avatar
  • 968
0 votes
0 answers
37 views

Copy one file every ten

I am pretty new to Linux and I got stuck on a very simple problem. Any help is greatly appreciated. I have folder with around 5000 images which are coupled because taken by two cameras at the same ...
user avatar
  • 1

1
2 3 4 5
23