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
3 answers
93 views

How to rename large number of randomly named file at one go?

In a directory I have large number of randomly named '.wav' files. For example 090913yui.wav jiyafa123.wav . . . awe-6rt.wav I want to change the file names to file1.wav file2.wav . . and so on Can ...
Turing101's user avatar
  • 157
-1 votes
1 answer
71 views

How to rename files in Linux like the ren command in Windows

I need to rename a bunch of files (more than 100) on an Ubuntu system, and want to know how to I do that when the pattern of the files is something like "Filename_01.jpg" to "...
Tornado726's user avatar
0 votes
2 answers
36 views

renaming files based on matched pattern in another file

I have a list of files: out_CCGCGGTT+CTAGCGCT_R1.fq.gz out_TTATAACC+TCGATATC_R2.fq.gz out_GGACTTGG+CGTCTGCG_R1.fq.gz out_AAGTCCAA+TACTCATA_R2.fq.gz ... the adaptor IDs (between the two underscores, ...
Anna1364's user avatar
  • 1,016
0 votes
1 answer
58 views

How to use sed on symbolic linked files?

I have some symbolic linked files and some normal files like below: P_2_UC34_31_1.gz P_2_UC34_31_2.gz P_2_UC34_32_1.gz P_2_UC34_32_2.gz P_2_UC34_33_1.gz P_2_UC34_33_2.gz P_2_UC34_31_1.gz and ...
beginner's user avatar
  • 277
1 vote
2 answers
28 views

Move and rename multiple subdirectories to new location

My directories are setup in this way: dir 1 001 11-20-2001-RT SIMULATION-57976 002 11-20-2001-RT SIMULATION-30560 003 08-24-1998-RT SIMULATION-72882 and so on for about 250 entries. My goal is ...
goldenburrito's user avatar
0 votes
0 answers
26 views

how to rename last part of multiple file in linux [duplicate]

I want to rename to files from below format to below format . How can i rename last part ? cheatsheetold1.gz.aux cheatsheetold2.gz.log cheatsheetold3.gz.out cheatsheetold4.gz.pdf cheatsheetold5.gz....
Anu's user avatar
  • 1
0 votes
1 answer
43 views

Renaming batch files for PLEX

I am attempting to rename a batch of .mkv files from the original format to the preferred PLEX format. I am having difficulty with sed and with rename and with mv. I hope it is just a syntax error I ...
kwayne's user avatar
  • 1
0 votes
1 answer
36 views

Rename directory hierarchy

How can I rename directory hierarchy? For example I want to rename c/d to x/y There won't be necessary only 2 folders. So the full directory path /a/b/c/d/e becomes /a/b/x/y/e after the operation. Not ...
ka3ak's user avatar
  • 1,235
4 votes
3 answers
813 views

Renaming files in Linux using perl scripting

I have a set of files with prefix, say "pre_", on a Linux machine and I just want to rename all of these files by removing that. Here is the perl code I wrote it doesn't throw any errors, ...
Sasi Pavan's user avatar
0 votes
2 answers
61 views

The loop for file renaming doesn't work right

There are 32 *.dds files in a folder: pic-0.dds, pic-1.dds, pic-2.dds,...,pic-31.dds I'd like to rename them to be: 015040.dds, 015041.dds, 015042.dds,...,0150471.dds. I'm trying to use the ...
misha.physics's user avatar
0 votes
0 answers
25 views

How to rename a one file name with another file part name in the same directory?

the database I am using is Unix and I am trying to automate where I want it to rename the file for me when I run it instead of me going to file and manually rename it. For example. Two files in the ...
Mawuko's user avatar
  • 1
1 vote
0 answers
16 views

Undoable rename [duplicate]

I have a large number of files (specifically, my music collection) that I plan to rename (using Ex Falso). I have the files backed up, so in principle I can restore if necessary, but that would be ...
mikado's user avatar
  • 129
0 votes
3 answers
51 views

Rename multiple folders using external string manipulation tool

I am using ccase. The following command works. $ mv camelCase (ccase -t Kebab camelCase) Now I am trying to rename multiple directories using: $ find . -type d -execdir rename 's/(.*)/$(ccase -t ...
Ahmad Ismail's user avatar
  • 2,500
-2 votes
1 answer
63 views

Need to batch rename files with names from text file using core utils

So I am a bit of a noob and have a problem at work. There is a program outputs names in a ie apple banana orange P1n34ppl3 The problem is that the files that correspond to that (separate program) are ...
Hulknosmash's user avatar
0 votes
2 answers
73 views

Removing certain numbers from batch of filenames

I have a batch of files that contain the numbers 21 to 29 in the middle of the file name. As I do not want to remove that number for hundreds of files by hand I tried using Terminal: for f in *; do ...
Michael's user avatar
5 votes
1 answer
124 views

Is there a *BSD equivalent of MacOS renameatx_np, atomic swap file renaming?

I am looking to create a *BSD compatible C function like the one below: int fs_ext__swap (const char *from, const char *to) { int res = renameatx_np(AT_FDCWD, from, AT_FDCWD, to, RENAME_SWAP); ...
Lee's user avatar
  • 491
0 votes
1 answer
50 views

How to find the text between the nth occurence of a character and occurence n+1 with perl-rename?

perl-rename 1.14-1 Arch Linux: linux 6.2.12.arch1-1 I have a directory/folder with several subdirectories, all are named by one of the following patterns Status quo of existing patterns something-...
henry's user avatar
  • 854
4 votes
5 answers
476 views

Bulk rename directories with spaces

I have a bunch of files and directories containing white spaces (several of them in each file name) and I'm trying to remove them. I am plagged with the 'dumb' rename that does not understand regex. ...
MBR's user avatar
  • 922
1 vote
2 answers
102 views

How to rename all files of the same name to another name in all subdirectories

I have a bunch of subdirectories with nested directories that have files with the name output.txt . I would like to rename all those files to output_modified.txt I tried find . -type f -name "...
Ddavid's user avatar
  • 11
3 votes
3 answers
619 views

Changing numbers in name of the file using terminal

I have a large number of files with names file00.txt, file01.txt etc in a folder. Is it possible to rename all where the numbers will change to (4000+200*number) in terminal? I want the name of the ...
Ganapati Dash's user avatar
0 votes
1 answer
59 views

gvsf (GNOME virtual file system) on usb-ios, when I git clone, I get: fatal: could not set 'core.filemode' to 'false' , due to OS service to rename

I usb-connect my ios device on my linux laptop. The linux system mounts a gvfs point to it (/run/user/1000/gvfs/afc:host=xxxxxxxxxx,port=3), I change directory there, I can rsync back and forth, but I ...
Bruno Schroeder's user avatar
0 votes
1 answer
85 views

Change file name based on contents

I'm trying to rename a set of files based on what is in the file itself. I have likely more than a thousand files to rename by the time I'm done. I have code that will get me the first part of the ...
JoJA's user avatar
  • 1
1 vote
1 answer
112 views

How can I rename files recursively using a regular expression

I have hundreds of files on a hard drive with many directories and sub directories which start with: 1.1, 1.2, 1.3, 2.1, 3.1, 9.1, 10.1, 10.2, Etc Etc... The problem is that when I list them they ...
Chris Fox's user avatar
4 votes
2 answers
592 views

Rename .gz files according to names in separate txt-file

I want to rename .gz files according to names in separate txt-file. I have a map with .gz files with the names: trooper10.gz trooper11.gz trooper12.gz etc. and I have a separate txt-file with the ...
Yoshi's user avatar
  • 43
0 votes
2 answers
194 views

Using 'TREE' for sub-subdirectories

Is it possible to use tree to create several output files without being cd ~/ into the directory I want to create a tree file? For example, I have a directory called parent-dir. Inside of parent-dir ...
linuxuser24569's user avatar
0 votes
2 answers
113 views

Command to gather all specified text files, rename them, and copy them to a folder

I have thousands of text files called file.txt. Because they all share the same name I cannot move them to the same folder without them overwriting. I need a command that will locate all of the file....
linuxuser24569's user avatar
0 votes
1 answer
44 views

qmv from renameutils doesn't support non-ASCII characters? $EDITOR shows bytes instead of Unicode chars

export $EDITOR=nvim mkdir -p /tmp/qmv cd /tmp/qmv touch 👨‍💻 qmv -f do * In Neovim (and nano too) it shows this: \360\237\221\250\342\200\215\360\237\222\273 instead of this: 👨‍💻 Is this a bug? ...
Andrew15_5's user avatar
1 vote
2 answers
72 views

rename first two periods to hyphens

I have the following command to change periods to hyphens in file names recursively, so long as they have another period both before and after them: find path/to/dir -depth -type f -name '*.*' -exec ...
ItHertz's user avatar
  • 87
0 votes
2 answers
53 views

How to combine files from incrementing directories into one directory

I have a directory structure that follows this kind of pattern: - Dir 01 (Disc 1) \ - Dir 01 (Disc 1).iso - Dir 01 (Disc 2) \ - Dir 01 (Disc 2).iso - Dir 01 (Disc 3) \ - Dir 01 (Disc 3).iso - ...
bashing_pumpkins's user avatar
1 vote
3 answers
138 views

Moving the year at the end of a directory name to the front, possibly convert into YYYY-MM-DD format

I exported all my pictures from Mac to my PC (Windows 11, but also running Ubuntu through PowerShell). The export created every directory (1000s of folders) in formats like the following and stripped ...
David's user avatar
  • 11
0 votes
2 answers
66 views

Renaming ogg files starting with i-

I have a directory with ogg file, and want to change file names starting with i-. What can I do? For instance, doing rename 's/i-nuovi/nuovi/g' * gave me Unknown option: marino-barreto-cinque-minuti-...
Vera's user avatar
  • 1,183
1 vote
1 answer
126 views

Copying/moving and renaming files from multiple subdirectories to parent directory

I have multiple directories, and each one of those directories contains an "example" directory which in turn contains images. What I want to do, is to add a textual suffix at the end of a ...
user5672's user avatar
0 votes
2 answers
191 views

PascalCase to lowercase-hyphen

I am new to renaming and have many files and folders in pascal case that I would like to convert to lower case, separated by a hyphen. I would like to run the command on both files and folders, ...
ItHertz's user avatar
  • 87
0 votes
0 answers
18 views

Renaming files with .- [duplicate]

Wanted to rename files that have string sequence .- in the file name. But the command outlined here removes any character preceeding -. rename 's/.-/-/g' How can I fix this?
Vera's user avatar
  • 1,183
0 votes
1 answer
27 views

Removing starting gl- using rename

I have a list of files, for instance ./2020/47-06/gl-086115.org ./2020/47-06/gl-085792.org ./2020/47-06/gl-086941.org ./2020/47-06/gl-087140.pdf ./2020/47-06/gl-085982.pdf ./2020/47-06/gl-087032.org ./...
Vera's user avatar
  • 1,183
6 votes
1 answer
2k views

What are the different versions of the rename command? How do I use the Perl version?

This is a mess. How do I know which command to use when we expect Perl's rename with s/// sed-like syntax, when there're tons of different implementations of rename, that are different versions of the ...
Gilles Quénot's user avatar
0 votes
0 answers
25 views

Changing names of files using find and rename [duplicate]

I am using the rename command to replace geo from the name of files residing in the current directory. rename "s/geo//g" * Because I have many directories with files in them, what can I do ...
Vera's user avatar
  • 1,183
4 votes
1 answer
801 views

Replace all periods with hyphens recursively

To replace all spaces with hyphens, in all files/folders, in all sub-directories, I run the following: find /path/to/folder -depth -name "* *" -execdir rename 's/ /-/g' "{}" \; ...
ItHertz's user avatar
  • 87
2 votes
3 answers
618 views

Recursively remove square brackets and their surrounded contents from file name

I am trying recursively remove parenthesis and it's contents ([.*]), if it is at the beginning of the file name. For example, [Author1]BookName.epub should be renamed to BookName.epub. But when ...
Ahmad Ismail's user avatar
  • 2,500
-1 votes
1 answer
87 views

Rename numbered files based on a list of corresponding names [closed]

I want to rename my files using a .txt file with proper names These are my files: lesson1.mp4 lesson2.mp4 lesson3.mp4 ... This is my txt file with names: 1 Entry to vim 2 Basics of vim 3 Vim motion .....
Kirill's user avatar
  • 9
5 votes
4 answers
3k views

Bulk renaming files from TitleCase -> Title Case (space separation) [closed]

I have a 38GB folder with 800 MP4 videos in it. After re-downloading it, the file name has no spacing, and all words are joined, but it's still TitleCase. So from TitleCase I need Title Case. What ...
GrumpyLondoner's user avatar
1 vote
1 answer
48 views

Rename filenames in different folders

I have a bunch of directories like the following with multiple files in each of them . ├── 20150320 ├── 20150321 ├── 20150322 ├── 20150323 ├── 20150324 ├── 20150325 ... Then I've put together ...
Juvenal Andres's user avatar
0 votes
2 answers
706 views

Rename files using regex to delete part of name

I have a bunch of files that I have to process on a Linux machine. The files look like this: 2009-08-18T034353_DR1_4N-NAC_123456_1234_band1.ntf 2009-08-18T034353_DR1_4N-...
Nunkuat's user avatar
  • 103
1 vote
2 answers
26 views

Number a bunch of files in a serial order with number as prefix

So, I've got 58 files on a Linux machine, with the sort of filenames given below: Theory of Computation (TOC) | Basics of TOC | Lec 1 | GATE Computer Science⧸IT Engineering Exam [7DOPjYGtnTQ].mp4 ...
Ishan Pandey's user avatar
0 votes
3 answers
215 views

Bulk rename files with numbers of unequal widths

I have files like file1.txt file2.txt file3.txt ... file11.txt file12.txt ... file100.txt file101.txt ... I'd like to rename them to have the same string width like file001.txt file002.txt file003....
rsaavedra's user avatar
  • 103
0 votes
2 answers
84 views

Bash script to rename files excluding names in array

I currently have a script where I rename files by removing whitespace and certain names. This is about 200 names so far so I though an array of names I want to exclude would be a better option. ...
superuser-Miguel's user avatar
0 votes
1 answer
97 views

Removing Asterisks in filenames

I have a number of files which contain "*" in various areas of the filename. *DOCUMENT.xls ***OTHER DOCUMENT***.DOC Does anyone have a suggestion to remove all instances of * from the names ...
Michael Swanson's user avatar
2 votes
2 answers
318 views

How can I bulk rename a lot of files on Ubuntu?

I have a directory that contains files named in pattern as: [HorribleSubs] One Piece - 01 [1080p].mkv [HorribleSubs] One Piece - 02 [1080p].mkv These files go up to 700. I wanted these files to get ...
Devansh Shrivastava's user avatar
1 vote
3 answers
679 views

bulk rename mp3 songs

I have hundreds of thousands of .mp3 songs recovered with testdisk and producing results such as in a directory: f196833984.mp3 however, when loaded in Rhythmbox, they show up as originally tagged. ...
gordon comstock's user avatar
1 vote
1 answer
63 views

Untar file tar compressed file to different directories [duplicate]

I have a .tar.gz file which may have the following files: folder1/folder2/folder3/imp_folder1/file11.jpg folder1/folder2/folder3/imp_folder1/file12.jpg folder1/folder2/folder3/imp_folder2/file21.jpg ...
thatGuy's user avatar
  • 11

1
2 3 4 5
24