Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
1answer
60 views

Batch to rename episodes

im trying to create a bash to automate rename files from, if for an anime: Example: [TAG] One Piece - 01 [Quality].mkv to: [TAG] One Piece - S01E01 [Quality].mkv But this isnt always because i ...
1
vote
1answer
29 views

Terminal: rename multiple JPG files to HEIC format giving a condition

I have a folder where there are many pictures taken with my iPhone. Turns out that half of them are JPGs and half of them were supposed to be HEIC format. For some reason, all pictures in this folder ...
0
votes
1answer
47 views

How to rename files with sequential names to an another sequence using Terminal?

I have a directory that has files in it that are named 'o1.ray' to 'o293.ray'. I want to move them to an another directory while renaming them 'o132.ray' to 'o424.ray'. How can I do this in the ...
1
vote
4answers
175 views

Script to rename a large number of files using the text in each file to rename

I am trying to devise a solution to rename a large collection of files so that the text in line 3 of each file is the new filename. These files all have the same structure. These are HTML files and ...
0
votes
2answers
33 views

Batch rename a lot of file using a number find in filename

I have hundred of file name with a number tag in filename like this: AAAA #12 SSSS.TXT BBB #231 CDF.TXT CDFSDAAAA #1 AAAASS.TXT and i want to rename so: #012 - AAAA #12 SSSS.TXT #231 - BBB #231 CDF....
1
vote
2answers
68 views

Rename files with consecutive numbers [duplicate]

I have about a thousand files that all look something like this: 20091208170014.nc 20091211150704.nc 20091214131328.nc 20091217111953.nc 20091220092643.nc 20091223073308.nc ...
0
votes
2answers
56 views

Bash-Script: rename files in folder order by file-date

I want to rename files in order of file-date; from example: file_1.pdf file_2.pdf to: file_1_ONE.pdf file_2._TWO.pdf The script must rename the first file to "ONE" ordered by file-date.
2
votes
5answers
477 views

I want to rename all files in a directory from *.ts to *.mkv [duplicate]

Rename all the files in .ts files in a directory My echo command works but not if I try to make it a new variable. #!/bin/sh for file in "${1}"/*.ts; do echo ${file} | sed -e 's|.ts|.mkv|' ...
0
votes
0answers
10 views

How to rename ISPConfig directories set by chattr command

I would to import a restore of a web directories to /var/www/clients/client4/web18/web managed by ISPConfig. I read ISPConfig put an attributes on this kind of directories. /var/www/clients/...
0
votes
2answers
40 views

Remove part of name after regex

I have a number of video files using a naming scheme like some-words-SxxExx.extension which is my preference. Unfortunately I have a lot of files in this format some-words-SxxExx-words-I-want-to-...
0
votes
1answer
33 views

Change file name while copying based on source path

I have a large number of files in directories of the format */*/*/*/*.txt and I would like to copy them into a different place while replacing the forward-slashes in the path with underscores. For ...
1
vote
2answers
94 views

Remove file-name extension, if it exists

Very new to scripting. I have a directory containing some text files and some with text files that also contain an additional extension (.xfr) e.g. file1.txt, file2.txt.xfr, file3.txt, file4.txt.xfr. ...
0
votes
1answer
48 views

How to use a Bash Script to move and rename files with grep

Hi I an FTP folder called Input where I get sent files which look something like this: "Guide to Iceland _ Chen-ping Wang itinerary T-987654987.pdf" "Guide to Iceland _ T-123654875 Chen-ping Wang ...
0
votes
2answers
30 views

Renaming part of name of all files in a directory tree if match

I have a directory tree like this . |-- players | |-- red_alice.plr | |-- red_bob.plr |-- resources | |-- red_cash.rsc | |-- red_food.rsc I want to go through all directories and rename any ...
8
votes
3answers
642 views

Flattening directory hierarchy preserving directory names in new directory name

I basically want to go from this: . ├── Alan Walker │   ├── Different World │   │ ├── 01 Intro.mp3 │   │ ├── 02 Lost Control.mp3 │   │ └── cover.jpg │   └── Same World │   ├── 01 Intro.mp3 │...
0
votes
2answers
67 views

want to Rename Images In Bulk in Linux

I have more than 1 million images with name of love-images-250x120.jpg 7788855441122-love-images-250x120.jpg us-wallpapers33344.jpg 77441144desktop-wallpapers.jpg desktop-wallpapers1144141411.jpg I ...
0
votes
5answers
94 views

Renaming files by extracting parts of filenames that match with a pattern

I want to know which command I can use to rename files like this. Let's say, for instance, the old filenames are: 0_predict-1-500.png 0_predict-2-500.png 0_predict-3-500.png 1_predict-1-500.png ...
3
votes
2answers
69 views

Bash - replace spaces with underscore but replace multiple spaces with one

I use rename to underscore spaces in filenames, simply with: rename "s/ /_/g" * but I encounter the problem that files downloaded from the internet often have multiple spaces. A nasty workaround I ...
1
vote
0answers
20 views

Renaming many files to their parent directory name [duplicate]

I want to recursively change many files named raw.tex to parent-directory-hw.tex. Is there a simple scripting solution to this problem? For example, running the script on . `-- root |-- baz |...
0
votes
1answer
41 views

Unix - replace filenames with unique prefixes in a directory with specific unique prefixes from a file in the same directory

I have hundreds of files in a directory with the same suffix and unique alphanumeric prefixes like this: ABC01234.sorted_dup.bam ABC04271.sorted_dup.bam ABC09287.sorted_dup.bam I have a file with ...
2
votes
2answers
36 views

Rename a specific part of a lot of files [duplicate]

I have a bunch of files named: Brooklyn Nine-Nine S01 E01 [H264].mkv Brooklyn Nine-Nine S01 E02 [H264].mkv Brooklyn Nine-Nine S01 E03 [H264].mkv Brooklyn Nine-Nine S01 E04 [H264].mkv Brooklyn Nine-...
0
votes
1answer
43 views

Rename multiple files using sed command after removing the string after the last underscore [closed]

I have a set of files in a directory as shown below and I want to remove the string after the occurrence of the last underscore from it. The string may be different each time. It will be good if it ...
1
vote
2answers
44 views

Make script to create subdirectories based on file name and move matching files into it [duplicate]

A folder has a huge number of files; each pair of files has the same name but different extensions (.obj and .mtl). I want to make a folder for each pair of files with the same name, then move each ...
0
votes
2answers
53 views

Batch rename media files

I have an Enigma2 FreeSat recorder that I've now hooked up to my Plex Media Server. Plex can see and play the files from the Enigma2 just fine, but the file naming makes this unattractive. How can I ...
0
votes
3answers
39 views

move a list of files to a list of locations

I'd like to move multiple files at the same time to specific new locations. Say I have the following wrong name | c.txt | a.txt | b.txt | Correct name| a.txt | b.txt | c.txt | I'd then like to ...
2
votes
3answers
163 views

'rename' with expression|replacement with a leading '-' (hyphen|minus)

I have many files like xyz_123_foo.ext for which I would like to add -bar to the filenames at the end to result in xyz_123_foo-bar.ext. I tried: rename . -bar. xyz_* which resulted in: rename: ...
0
votes
2answers
60 views

How can I change lower to upper using (three) parameters in bash? [closed]

I have to make a bash script that will be changing files' names from lower to upper OR from upper to lower via parameters in command line. So when I put in command line: ./bashScript lower upper ...
1
vote
4answers
58 views

How to rename files pulled from a list of files using a single command or line

I have a project named my-project with the following file tree. my-project/ (before) . ├── src │ ├── index.html │ ├── main.js │ ├── normalize.js │ ├── routes │ │ ├── index.js │ │ └── ...
0
votes
2answers
37 views

delete then rename: same filenames different extensions

I have a directory containing thousands of files, each file has a duplicate. An example: file1.txt file1.jpg.txt file2.txt file2.jpg.txt I want to delete all *.txt files, and leave the *.jpg.txt ...
-1
votes
1answer
42 views

Rename files on QNAP linux (batch)

I have a folder with at least 30 files. The names are: 123456_12_12_AB12_NAME.mp4?BWSQv6seywG5ND2Myt7YM3JHPmaaNmtBRI0PcXbYpqoS01ivTvL0HCHvjfjFtOM9AMq7-kpHUZ0W_m8njEjqBkM9uyngsnKANw How can I get ...
1
vote
2answers
29 views

Batch rename files to move sequence from end to beginning

I have a bunch of files that are from using IM's convert from a PDF to many image thumbnails. On that conversion, I have files named something-0.jpg. So, say a PDF has 45 pages, each page is: ...
0
votes
3answers
74 views

Remane filename by switching what is before and after an underscore

I would like to rename a number of files that have the following formatting: ABCD_20181102.jpg DEDE_2_20181030.jpg i.e usually 4 random letters, followed by an underscore and a date (year, month, ...
3
votes
1answer
81 views

Atomically write a file without changing inodes (preserve hard link)

The normal way to safely, atomically write a file X on Unix is: Write the new file contents to a temporary file Y. rename(2) Y to X In two steps it appears that we have done nothing but change X "...
1
vote
2answers
69 views

Removing digits from beginning of filename [duplicate]

I was hoping this would work: $ find . -type f -exec basename {} \; | while EFS= read -r f; do echo "${f##[0-9]}"; done But, for example, for files named as: 1foo 11bar it returns: foo ...
0
votes
4answers
88 views

Recursively rename all the files without changing their extensions?

How to recursively rename all the files in several layers of subdirectories without changing their extensions? Below's a toned down version (to save room) of what I've got. For argument's sake, I ...
2
votes
2answers
85 views

trying to Rename multiple file names within all directories of a project

ive recently been trying to change the names around in my project and have been having some trouble getting the task done properly. my problem is when I try to use find . -type f -print0 | xargs -0 ...
-1
votes
3answers
45 views

Renaming files by the day they created

I have files I would like to rename it using the date they created. How can I do this automatically? Looking at the properties for every file then renaming it is a real pain. For example In a folder ...
2
votes
2answers
102 views

how to increase the file extension numerically by one

under the following current folder, we have the example of files lok.log.1 df.log.6 weq.log.90 vr.log.11 vs.aw.frsd.log.3 we want to increase the files extension by 1 so the expected output will be ...
0
votes
2answers
97 views

Rename files based on list

I have these video files; Fringe.S03E01.mkv Fringe.S03E02.mkv Fringe.S03E03.mkv etc... I also have a .csv text file of the episode's titles; 01,Olivia 02,The Box 03,The Plateau etc... what I am ...
0
votes
2answers
68 views

How to rename multiple files into one name [duplicate]

I would like to rename these files; 2000.jpg B001.jpg 9002.jpg D006.jpg to these names below ICON000.jpg ICON001.jpg ICON002.jpg ICON006.jpg respectively.
-1
votes
1answer
20 views

how to rename a remote repo name so that it makes sense to you while git cloning [duplicate]

Usually the way I do renames to make sense for myself is - $ git clone <remote URL.git> $ mv remotedir nameIwant I was wondering if there is a better way to do it. The reason is sometimes ...
0
votes
1answer
351 views

Renaming a file on FTP server with a timestamp variable

From my linux machine, I connect remotely to an FTP server using the following command: ftp ftp://USERNAME:PASSWORD@FTPSERVER/array1/DIR1/DIR2/ In this DIR2 there is a file called running_config ...
2
votes
2answers
49 views

How to rename multiple files containing _ and .?

In linux bash shell, I have multiple tif files (around 1000) as follows: Sep04_17.00.37.tif Sep04_17.05.54.tif Sep04_17.08.41.tif Sep04_17.02.02.tif Sep04_17.07.17.tif How Can I remove the _ and ....
3
votes
2answers
226 views

Renaming files to remove parenthesized strings

I have a collection of files with names like these: Ace of Aces (Europe).mp4 Action Fighter (USA, Europe) (v1.2).mp4 Addams Family, The (Europe).mp4 Aerial Assault (USA).mp4 After Burner (World).mp4 ...
0
votes
3answers
312 views

How to rename multiple directories?

Here are my directories: P [001] P [002] P [003] I want to rename to: P001 P002 P003 I used the code: for P in *\ *; do mv '$P' '${P// /_}'; done but I am missing something.
1
vote
1answer
44 views

batch rename folders with value from json value in package.json

This is a bit of a crazy one, but I am wondering if it is even possible. I have maybe 300 folders in my /var/www folder that were all renamed to the same name [Name](Num) so kindred (19) for example. ...
0
votes
1answer
42 views

Rename Files to Consecutive Integers [duplicate]

I have bunch of files in one directory, like these: 0002.b3120c4bcbf3101e661161ee7efcb8bf 0003.acfc5ad94bbd27118a0d8685d18c89dd 0004.e8d5727378ddde5c3be181df593f1712 0005....
0
votes
3answers
76 views

Unix command to remove space from a file name

I have a file whose file name has a space like First Name_20180810.csv. The date (20180810 in the above example) changes daily in the filename. How can I rename First Name_*.csv to be FirstName_*.csv?...
1
vote
3answers
190 views

Trying to change multiple files' extensions

Using the command line (in Fedora) I'd like to rename all the files in the current directory, that have "foo" for the extension, to the same name but with foo1 for the extension. I've tried several ...
0
votes
1answer
39 views

Rename files in bash scripted based on file modified date

It has been awhile since I have had to drive into shell scripting. However, I have a shell script where I'm renaming files based on the file extension from a ftp upload. Currently, the files are ...