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

0
votes
2answers
35 views

Rename specific level of sub folders

I have list of sub folders inside a parent folder as follow: Parent folder folder1 foldera folder2 folderb folder3 folderc I want to rename the subfolders only in ...
2
votes
5answers
91 views

Change strings in multiple files to current subdirectory name

I have several directories each containing a file containing this line: ../a_a_q1.out ../a_a_q2.out ../a_a_q3.out I would like to loop through all the subdirectories, and change the a_a part to the ...
5
votes
4answers
36 views

Renaming: How to attach a word or rename multiple files [duplicate]

I have multiple files in my directory. for example: eventDataLog.txt.2015-04-23-22 eventDataLog.txt.2015-04-23-23 eventDataLog.txt.2015-04-24-01 eventDataLog.txt.2015-04-24-02 ...
0
votes
3answers
88 views

How to rename all files with special characters and spaces in a directory?

How can i rename all the files in a specific directory where the files contains blanks spaces and special characters ($ and @) in their names? I tried the rename command as follows to replace all the ...
0
votes
1answer
26 views

Renaming Duplicate Files with Flatten Folders Command

This command will move the contents of one or more folders to the parent folder. But if there are identical file names with the same extension then there will be files that are overwritten during the ...
1
vote
4answers
192 views

change last 10 characters of the base (not extension) of multiple files

I have many files of different lengths but the same extension and I have tried many commands to rename all of them at once. Is it possible to change only the last 10 characters of the base of all ...
1
vote
2answers
36 views

Make a Scheduled job for Renaming the files in a folder and send an updated alert email

I am writing a shell script, which can rename all the files in the folder, We need to search for a particular pattern of files every 30 seconds. Files in the below format need to be selected, ...
2
votes
2answers
51 views

remove whitespace from all items in a directory and sub directory

I have a directory which contains files and sub directories, some of which have whitespace in their names. Further more each of these sub directories contains files with whitespace in their names. Is ...
-3
votes
0answers
49 views

Bash Script for Renaming files

I need a shell script, which can rename all the files in the folder, Like Go into the designated folder, Search for all the files like Core.3467 core.1234 core.acde and change it to like ...
2
votes
2answers
106 views

Rename a set of files with pattern <name>.1.gz.html to <name>.html

I tried to use the command: mv *.1.gz.html *.html But, I got the response: <filename> is not a directory. How can I get this working? I tried the rename command as well, but, I couldn't ...
3
votes
2answers
61 views

Recursive copy files with rename

If I have input folder files_input that has subfilders like 01-2015, 02-2015, 03-2015 etc and all these subfolders have other subfolders. Each subfolder has only one file called index.html. How can ...
0
votes
1answer
33 views

Rename command not working as expected

I might be overlooking something really basic here but I have a bunch of files like fi-le_00.nc2 fi-le_01.nc2 fi-le_02.nc2 ... fi-le_24.nc2 and I want to rename them to fi-le_00:00:00 ...
5
votes
2answers
153 views

Why does renaming a file with mv command alter an inode's “change” date & time?

A file hello.c is renamed to hi.c. As the output of stat command shows, [change] time stamp has been changed. usually it is changed when inode of file got modified. Why renaming with mv command ...
1
vote
2answers
33 views

How to add some characters to filename via 'rename'?

For example I have a file named 5.jpg. How can I rename it to aaaaa.jpg with char a 5 times. I tried rename -v 's/(\d{1,})/a{$1}/g' * but this renames 5.jpg to a{5}.jpg, which is not what I want. I ...
1
vote
4answers
77 views

Remove all brackets in filename

I've been trying to remove all brackets in my filename(s). Can anyone help me create a bash script to do that? This bash script below work flawlessly for non-bracket filename(s), but if there are any ...
1
vote
3answers
101 views

Script to move one filetype and create a subfolder, if it exists?

I'm trying to find a script that would basically look recusively at a directory, and if the script finds file that are .flac files, it will create a subfolder called FLAC in that same folder, and move ...
3
votes
3answers
87 views

How to change suffix of the files

In a directory structure which has multiple subfolders and files in it. Some of the file names have the suffix _create (e.g. java1_create) and some of them with _bak (java2_bak). I need to rename ...
2
votes
3answers
185 views

Add extension for multiple files, based on their types

I know that there are many questions about adding extension to a multiple files. But none of them could get my job done. I have a huge list of images without extension, most of them are png, but ...
4
votes
4answers
576 views

How can I copy a file in a bash script and rename it while copying and place it in the same directory

How would I copy a file "file.doc" and rename it while copying to "file_copy.doc" and place it in the same directory ? And this only by calling the script and adding the file name in the argument: ...
0
votes
5answers
68 views

same file name in multiple directories: how to assign them with different names at the same time with only one command?

I think the title is self-explanatory, but my problem is: I have 23 different directories and in each one of them I have a file called accepted_hits.bam so I need to generate a unique name in each ...
1
vote
2answers
79 views

Remove string from file name to leave variable?

I have the following list of files: Dorn_Triatomine_A5201_sequence_1_unmappedforTdim_tdim.alleles.tsv Dorn_Triatomine_A5201_sequence_1_unmappedforTdim_tdim.matches.tsv ...
0
votes
3answers
54 views

Remove trailing ~ from files [closed]

I have a list of files ending with ~ I find them with find /var/www/vhosts/domain.com/httpdocs/ -type f -name "*.*~" How can I eliminate that ~
3
votes
7answers
151 views

find files based on name and moving them with renaming simultaneously

Consider I've directories named according to years and containing pdf files according to subject-code. ls output is: $ ls -l total 32 drwxrwxrwx 1 root root 4096 Apr 8 08:52 May-June-2011 ...
1
vote
3answers
79 views

Rename files (delete some characters that are not always the same)

I have some files named like this : DA1_ATGCATG_L001_R1.fastq.gz Oeu43_TCATGAC_L004_R2.fastq.gz I want to delete the part after the first "_" but keep the end of the names from "_R" to obtain this ...
1
vote
1answer
56 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
300 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
54 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 ...
3
votes
3answers
142 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
135 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 ...
4
votes
4answers
83 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
78 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
49 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
123 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
56 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
50 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
41 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
367 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
125 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
143 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
60 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
109 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
59 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
199 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
1k 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
75 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
70 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
97 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
24 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
136 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
38 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?