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
2answers
254 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
97 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
653 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
27 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
85 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
36 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
120 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
99 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
33 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
660 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
84 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
101 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
306 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
27 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
44 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
38 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
104 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
64 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
75 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
44 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
258 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
108 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
59 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
55 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
78 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
41 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
173 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
155 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
101 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
101 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
96 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
47 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
109 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
186 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
98 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
36 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
823 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
71 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
323 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
872 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
57 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
58 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
82 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
534 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
77 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 ...
6
votes
4answers
932 views

Change some file names (prefix to postfix)

I have a directory containing thousands of files with names t_00xx_000xxx.png and 00xx_000xxx.png. I want to change the names of the files which starts with t_, like t_00xx_000xxx.png to 00xx_000xxx_t....
8
votes
4answers
396 views

Rename multiple files with 2 conditions/replacements in one line?

I'm trying to rename a few images: IMG_1.JPG IMG_2.JPG IMG_3.JPG I want to replace IMG with img and .JPG with .jpg - I know how to do the second part: $ rename 's/\.JPG$/\.jpg/' *.JPG My problem ...
0
votes
2answers
43 views

Reverse-exchange file names of files in a folder from bottom up

I have a some jpg files in a certain folder: hg_test_spr.jpg hg_test00001.jpg hg_test00002.jpg hg_test00003.jpg hg_test00004.jpg hg_test00005.jpg hg_test00006.jpg . . . hg_test01200.jpg I want to ...
2
votes
3answers
343 views

Batch rename file by substring the filename

I have files .. 00016_0912RP10R6_RampMotorway9_0912RP10R6_13.646852_100.687103.jpg 00017_0912RP10R6_RampMotorway9_0912RP10R6_13.646956_100.686897.jpg 00018_0912RP10R6_RampMotorway9_0912RP10R6_13....
0
votes
1answer
169 views

using Find -exec to rename a file with the grepped contents of the file

I'm attempting to get a list of files with find and then use pdfgrep to get a string from the file, then rename the file with that string. The commands broken down are: find . -name "*...