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.

learn more… | top users | synonyms

1
vote
1answer
20 views

How to change configuration of detox (dash instead underscore)?

I found, best to this moment, a solution when changing all those annoying filenames in large quantities, making them readable and easier to manipulate with in command-line. So I found, among many ...
5
votes
2answers
234 views

cannot rename files with `[ ]` on its name?

I'd been trying to use the rename function in my debian, I searched here at unix.stackexchange but it seems the solution is not the same in my scenario which files contains [] ...
1
vote
1answer
15 views

File corruption using rsync, multiple rsync processes, moved/renamed source file

I'm encountering some file corruption when using rsync (that is, the file contents do not match the source file). I can understand the file becoming corrupt if it is being written to while being ...
2
votes
3answers
99 views

remove all instances of _000 from multiple files

Had to recover my music library from a HDD which died.... got everything I wanted but all music track names have _000 added at the end. I really don't fancy going through 8000 individual music tracks ...
1
vote
2answers
73 views

Mac Terminal - rename *.png.png to *.png

I have a bunch of images that I'd like to rename as follows: *.png.png --> *.png *.jpeg.jpg --> *.jpg *.JPEG --> *.jpg The only thing I've tried thus far is mv *.png.png *.png, but I knew ...
3
votes
3answers
53 views

Traverse, copy & transform file names

My issue: I need to copy log files, all with identical names, but stored 1-deep in subdirectories, and change their names. I'm copying from the a folder called Logfiles which contains a bunch of ...
-1
votes
1answer
24 views

Copy files from find command [closed]

I am trying to copy all *file.log files found using find. The problem is all files are named the same and it is only copying over one file. I need to find a way to rename the files in the command or ...
2
votes
3answers
35 views

Rename multiple files to their suffixes

I need a way to rename a couple of files containing spaces. I have: >ls Garbage Foo1.txt Garbage Foo2.txt Garbage Foo3.txt Garbage Foo4.txt ... And I need: Foo1.txt Foo2.txt Foo3.txt Foo4.txt ...
2
votes
4answers
87 views

Add 0 in the middle of a filename

$ ls pro2e_u01_txt_vocabulaire_11_descriptiveadjectives.mp3 pro2e_u01_txt_vocabulaire_12_nationality.mp3 pro2e_u01_txt_vocabulaire_1_campus.mp3 pro2e_u01_txt_vocabulaire_2_personnes.mp3 ...
1
vote
1answer
43 views

Renaming multiple files; appending

I'm looking to rename multiple files with the same name, with exception to the end of their file names. I want to replace the differing parts with an incremental counter. E.g. With the following ...
1
vote
3answers
37 views

How to mass rename files with ill-formed numbering?

I've got bunch of files with ill-formed numbering: prefix-#.ext | for files with number 1-9 prefix-##.ext | for files with number 10-99 prefix-###.ext | for files with number 100-999 ...
2
votes
1answer
31 views

Copy files that partially matches another files in another location

I have a list of jpeg files in a directory like this (below is just a sample, like the structure is the same but this there are many fo0# sub-folders, not only fo01 and fo01, where each of these ...
2
votes
4answers
139 views

Creating directories in a loop and moving files to those directories

Consider a directory with N files. I can list the files alphabetically sorted and store the list by ls > list Then I want to create n sub-directories in same directory, which can be done by ...
2
votes
1answer
37 views

Remove newlines in file names

I have a PHP code that generates the file name on which wget will append its logs. I generated 2000+ files, but the problem is I am having trouble working with them because I had a mistake of putting ...
1
vote
2answers
51 views

Rename files depending on their parent directory

I have a main directory, let's say main. This main directory has some folders, among which are three folders named ccc ddd and lll, which are the only folders I want to target and work on. Each of ...
1
vote
0answers
32 views

Automatically Rename File if there's a Duplicate Filename

I have a command that creates montages of images. Sometimes I want to save multiple montages from a series of images in a folder. The montage will be saved as output.jpg. But if I create another ...
1
vote
0answers
44 views

How to rename file and folder of mp3 based on ID3 tag

How to rename music files based on ID3 tag with format: number. title where the number doesn't exists on the id3tag but exists on the file name? And how to rename folders based on ID3 tag with format ...
0
votes
3answers
44 views

Change Multiple (Including No) File Extensions

If I have a directory of files, where some files have an extension like .html and some files have no extension, how do I change them all to, e.g. .txt?
2
votes
3answers
91 views

Copy files to a destination folder only if the files already exist. but the source files have a different file extension

Copy files to a destination folder only if the files already exist. but the source files have a different file extension. i.e I have a backup of some files with ".desktop.in" extension and I want to ...
17
votes
2answers
916 views

Renaming the current directory from a shell - possible?

Is it possible to rename the current working directory from within a shell (Bash in my particular case)? If I attempt to do this the straightforward way, I end up with an error: ...
1
vote
1answer
35 views

Batch rename “case duplicates”

I have a folder on my Linux system that is cross-synchronized with other computers, some of them with Windows. The problem is that in that folder there are files that are "case duplicates", i.e. their ...
0
votes
3answers
42 views

Renaming multiple Files, Bash Script, preferably with an Addition

Hello you wonderful people, I have a little problem creating a Bash Script. I have 7000 image files (dicoms). These files belong together and should be in order in ONE directory. However, the program ...
1
vote
1answer
87 views

Swap two files in bash [duplicate]

How do I swap two files in Linux console with minimum typing? Boring approach: $ mv file1.dat fileX.dat $ mv file2.dat file1.dat $ mv fileX.dat file2.dat
1
vote
1answer
18 views

Rename command with non-existing target directory

I'm trying to group files automatically into subdirectories using a command like this: $ rename 's/(.)(.)(.+)/$1\/$2\/$1$2$3/' *.* A dry run with the -n parameter shows me what I want: test.jpg ...
0
votes
1answer
91 views

rename multiple files with one variable

I am trying to rename one file with one variable. Example: 2014.001.**.**.**.D890.E.m to IP.PMST..BHE.D.2014.001. My script is: #!/bin/bash cd /home/pintolcv/Downloads for jd in {001..366} do ...
-1
votes
1answer
25 views

Rename multiple file with no extensions? [duplicate]

I have multiple files all named seperate1 seperate2 etc. How do I rename them all to have the extension .csv?
0
votes
2answers
65 views

Rename file by it is folder name

I have a sort of folders (A,B,C,D,E,F,G,H) and I have one file in every folder has the same name in all the folders (file.txt) but the size of this file is different from folder to folder. I wanted to ...
1
vote
4answers
448 views

rename multiple files with mv

I want to rename a couple of files in the same directory. When you start to google this there is plenty of help available. What i saw the most if you only want to change the extension is mv *.txt ...
1
vote
1answer
200 views

Rename files based on directory names

How can I rename .jpg files in multiple folders based on the name of the folder? I also want the .jpg files to remain in their respective folders and not moved. The folder names have no spaces. So, ...
2
votes
2answers
41 views

Renaming files from prefix and sufix

I've a series of media files I'm trying to rename en mass. 001 - 01x01 - mediaTitle1.avi 002 - 01x02 - mediaTitle2.avi 003 - 01x03 - mediaTitle3.avi What I'd like is to output: Series Title S01 ...
1
vote
7answers
262 views

Remove a specific extension from all the files in a directory

I have a couple of files with ".old" extension. How can I remove the ".old" extension without remove the file? I can do it manually but with more work: mv file1.key.old file1.key mv ...
2
votes
2answers
107 views

How to rename thousands of files efficiently?

I have a bunch of music files (literally thousands of files) in my Fedora PC that I'd like to rename with two rules: Every space must be replaced by the character _ (underscore), and Every letter in ...
2
votes
4answers
119 views

Flattening folder structure

I have this folder structure: ├── foo1 │   ├── bar1.txt │   └── bar2.txt ├── foo2 │   ├── bar3.txt │   └── bar4 with a space.txt └── foo3 └── qux1 ├── bar5.txt └── bar6.txt that ...
3
votes
2answers
102 views

Atomic removal of directory

Because rename(2) is called by mv, is it safe to assume the following would be atomic? $ mv /home/me/someDir /tmp/toBeDeleted $ rm -rf /tmp/toBeDeleted
1
vote
4answers
577 views

Bash rename 360 000 files using find -exec

I've got around 360 000 files like: ./001/1/1.jpg ./001/1/2.jpg ./001/2/1.jpg ./002/1/1.jpg ./003/1/1.jpg ... pattern: [60 dirs]/[1000 subdirs]/[4-10 files].jpg I want to rename files using rename ...
5
votes
4answers
392 views

Remove next-to-last extension in a file name

Suppose a folder with many files with bad extensions,for example Song1.avi.mp3 Song2.avi.mp3 Song32.web.mp3 Song23.mp4.mp3 Song2a.mp9.mp3 I want to remove only the second field (web, avi, mp4). I ...
6
votes
2answers
150 views

renaming all files in all sub directories

How to rename all files in all sub directories, with the sub directories name and auto number. ex: parent -subdir --file.jpg --cat.jpg --dog.jpg rename to : parent -subdir --subdir_01.jpg ...
0
votes
2answers
1k views

how to rename multiple files by replacing string in file name? this string contains a “#”

How to replace a text string in multiple files in Linux How to rename multiple files by replacing word in file name? Replace string in files with certain file extension Searching a number of files ...
0
votes
1answer
82 views

Rename files in selected folder in Linux [duplicate]

Command for rename file as IMG0001 to 4R0001 in folder for f in *;do mv "$f" `echo "$f" | sed 's/IMG/4R/g' `; done AND I just want rename selected folder /tmp/2014/1201 (rename files) ...
3
votes
3answers
91 views

MMV mass file rename

I'm having trouble figuring an mmv pattern. I have a bunch of video files with this pattern: my.program.name.season.NN.episode.NN.-.title.avi and I need to move them to: ...
1
vote
2answers
120 views

How to rename file in bash script one by one

I have loads of files which look like this: data1.csv data2.csv . . data(n).csv My use case is that when I will call my script it will change data1.csv to data.csv and remaining files as it is and ...
1
vote
5answers
103 views

How to move a file and change its name without retyping the name and just add the new characters

I change too frequently the location of some files generated daily. The thing is that I want to change their names by only adding the new required characters. What I want is something like this: $ ...
1
vote
1answer
86 views

batch-rename all config file endings to conform to apache 2.4

since apache 2.4 all files in /etc/apache2/sites-available and sites-enabled have to be named with the ending .conf Now on my server I have a lot of these files, renaming the files in sites-available ...
0
votes
3answers
66 views

Replace occurrences of character in filenames [duplicate]

How can I replace all the occurrences of the + character in all the filenames in the current working directory with the space character? I know that there's the linux command rename but I'm not sure ...
2
votes
2answers
96 views

Rename files with even numbers

I have a collection of images which are scanned pages of books. They total some 10,000 pages. The books were printed bilingually, with the text and translation on facing pages. The translation has ...
0
votes
1answer
74 views

defining rename command scope; replace word; replace entire file name; wildcards

Im looking to use the rename command to edit file names. More specifically, Im trying to isolate specific pieces to change, or in some cases, the whole name. For example: Lets say I have three ...
1
vote
1answer
49 views

How to change double hyphen to single hyphen of file names?

I have been using the rename command to get control over my naming conventions across my system. In converting spaces in file names to hyphens, I have inadvertently created consecutive hyphens in some ...
1
vote
3answers
188 views

Add or subtract a number from the names of all the files in a directory

I have a number of png and jpg files whose names are numbers, e.g.0100.png, in a directory, How can I add 1 to their names, for example, to get 0002.png and 0003.png from 0001.png and 0002.png ...
1
vote
1answer
70 views

perl rename: Prepending something to a set of file names across subdirectories

Although perl's rename tool has become an invaluable companion for my daily work, there are still some quirks that make work more difficult - especially when files are not in current work directory. ...
6
votes
4answers
276 views

Strip Filenames and Rename

What rename command can I use which will delete the present filenames in a directory and replace them with alphanumeric filenames? Such as gg0001, gg0002, et cetera? And I'd like the command to work ...