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
4answers
37 views

Rename files randomly but without repetition

Suppose i have a folder with a lot of file names some very strange and nonsense I want to rename it like File-1 File-2 File-3 .. I have tried this(echo is for tryng) for name in *; do echo mv ...
0
votes
2answers
20 views

Batch rename long filenames of variable length with years

I have a bunch of files in a single directory that I would like to rename as follows, example existing names: 1937 - Snow White and the Seven Dwarves.avi 1940 - Pinocchio.avi Target names: Snow ...
1
vote
2answers
36 views

Renaming a file the moment it appears in a folder

Here's the context : on a samba server, I have some folders (that we'll call A,B,C,D ) which are supposed to receive files from a network scanner. The scanner renders a PDF file named like this : ...
3
votes
3answers
44 views

backreferences in `rename` regex

I have A LOT of files named "bar_foo.txt" in a directory, and I'd like to rename them to "foo_bar.txt" instead. In sed and vim the regex to to this would be something like ...
2
votes
4answers
94 views

Moving and renaming hundreds of .jpg files, all named 5003.jpg

So here's the deal, my girlfriend wants me to transfer all of her photos off from her iPhone onto her laptop (on which we are running Ubuntu 14.04). All of the dedicated programs I tried to do this ...
2
votes
2answers
69 views

How do I rename files using the directory name?

My file structure now is: Input 1 pre.nii 2 pre.nii I would like it to be: Input 1_pre.nii 2_pre.nii From the Input folder, I tried: for i in */pre.nii; do echo $i_pre.nii; done ...
3
votes
3answers
171 views

move middle part of filename to front

I have files named in the style 02.04.11 DJ Kilbot.mp3 (for several dates) and I want to reformat the name in this manner: DJ Kilbot 2011-02-04.mp3. In other words, the current format is MM.DD.YY ...
0
votes
1answer
12 views

rename all files in a folder deleting duplicate string-parts

I have a folder with lots of subfolders, that contain two times the same but slightly different: Movie1 {Action}{Adventure}{Sci-Fi}{Thriller}{Science Fiction}/ Movie2 ...
1
vote
3answers
52 views

Add extension to a list of files

I am trying to determine a perl method to add an extension to a list of files. I can already rename a list of files with a certain extension to some other extension, but I need to be able to do this ...
0
votes
2answers
60 views

mass renaming of files not working

Quite a few similar question are being asked. The error is probably staring at me in the face, but I just can't see it... #!/bin/bash declare -a files shopt -s nullglob files=(*) count=36 # ...
1
vote
2answers
21 views

How to change the default use of detox, so it just doesn't replace spaces by underscores

I'm happy with the default usage of detox for sanitizing filenames, except I don't always want to replace whitespace with a single underscore. Would like to replace whitespace with a single space. ...
7
votes
7answers
540 views

How to rename splitfile[a-z] to splitfile[1-26]

I am trying to rename files named in the form of splitfile[a-z] to splitfile[1-26].csv, that is I want to rename splitfilea to splitfile1.csv and so on. I tried the following command: mv ...
5
votes
5answers
263 views

Rename files based on their parent directory using find/xargs command?

I have a directory structure like this: Project/ | +--Part1/ | | | +--audio.mp3 | +--Part2/ | | | +--audio.mp3 | +--Part3/ | | | +--audio.mp3 ... I want to ...
1
vote
3answers
60 views

Renaming thousand files with similar names

I'm having a difficulty creating a bash script to rename my files,so i'm asking for help. The files are in the same folder and all look something like this 1xxx_(bunch of characters)=(bunch of ...
0
votes
1answer
35 views

Script for renaming files using text file containing alternate file names

I have a folder containing thousands of files: file1.jpeg file2.jpeg file3.jpeg etc. I have a text file containing a list of new filenames I want to substitute: old_filename new_filename ...
1
vote
1answer
16 views

Rename files to insert _ between StudlyCapsified words

I've a music lib where files names are like 05WithoutWallsSpanishMixChillDeLucia.mp3 (no space between words BUT exist a capital letter at beginning of every word). How do I detect this string form ...
5
votes
3answers
105 views

Auto increment filename

I have a need to collect some duplicate files and want to avoid name collisions. The problem is that this collection of files might be added to by another execution of my script before the files are ...
1
vote
1answer
25 views

Why isn't this perl regex capturing the backreference?

I have a directory of files $ ls -1 ep2.mp4 ep3.mp4 ep4.mp4 ep5.mp4 ep6.mp4 ep7.mp4 I want to use the perl rename utility to make all files look like e.g. ep02.mp4 Command I am using rename -n ...
-1
votes
1answer
24 views

How to rename group files [duplicate]

How to rename a group of files tl_0014_0010_20151212_133443.jpg tl_0014_0010_20151212_133543.jpg tl_0014_0010_20151212_133643.jpg ... to photo00000.jpg photo00001.jpg photo00002.jpg ... ?
2
votes
3answers
134 views

Replace underscores with spaces for all files in directory

For all files in a directory, I want to replace the underscores in the filename with spaces. I tried this solution, which does the opposite of what I want: ...
3
votes
1answer
61 views

move files based on pattern with zsh/zmv

How could I move files to subdirectories based on the common part of their names? For example, with files named as comment_LastName.pdf and comment_LastName.md and sub-directories named as ...
1
vote
1answer
33 views

Is it possible to rename a process you own from outside that process?

If I'm logged in as $USER, and I run top and I can see a process I own can I rename that process? If so, how? If not, can root rename a foreign process? If so, how? If not, why?
0
votes
0answers
31 views

Move files according to their name in corresponding folder only if the file does not exist already

I created a script that creates reports using R and Latex and that should move the reports to a designated location only if a report with the same size does not already exist there. The script looks ...
1
vote
3answers
49 views

Rename files in directory based on names of files on another directory

I'm not sure if this has been asked here but here is my problem. I have files in lets say dir1 named: File 1.mp4 File 2.mp4 etc.. Now on directory dir2, I have files named: Sub 1.srt Sub 2.srt ...
-2
votes
2answers
71 views

How to rename bulk of jpg files to png using convert

Let's say I have a bunch of .jpg files which I want to convert to .png. The file structure is as follow: 00-01.jpg 00-02.jpg 00-03.jpg 00-04.jpg 00-05a.jpg 00-05b.jpg 01-01.jpg 01-02.jpg ...
1
vote
5answers
115 views

How can I rename a file on unix using characters in filename?

I have a bunch of files in a unix directory that look like the following: filename_1234567.txt I need to rename them by copying the last three characters of each filename to the front of the ...
3
votes
2answers
64 views

How to keep exactly one file in a directory?

I have recovered files and currently they have this structure: root/MD5_of_file1/file1 root/MD5_of_file2/file2 ... root/MD5_of_filen/filen Obviously, duplicates are now in the same folder. The ...
0
votes
0answers
24 views

Nemo file renaming display glitch

When I try to rename a file in the Nemo file explorer it moves the name to the left so that about the first 5 characters are behind the sidebar. It looks like this: I'm currently running ApracityOS ...
0
votes
0answers
23 views

Error: rm /u01/sbldev01/siebel/siebsrvr/objects/esn/siebel_sia_OLD_20151110.txt: no such file or directory

I have a small sh that rename 2 files. However, when I try to download the file generated, I got the error: Error: /u01/sbldev01/siebel/siebsrvr/objects/esn/siebel_sia_OLD_20151110.txt: open ...
2
votes
3answers
289 views

Renaming files without file extensions

I have a series of files named KLLxxx (the x represents numbers). They're text files but have no file extension to them. Just files that say KLL followed by three digits. I want them all to end with ...
1
vote
3answers
131 views

Move files up by a directory by depth criteria

I have a directory tree that looks like this (simplified, in truth there are hundreds of folders): . ├── a │   └── b │   └── a.h5 ├── b │   ├── b │   │   └── e.h5 │   └── c │   ├── a.h5 │   ...
0
votes
1answer
23 views

how can I target filenames with 2 digits with the rename tool?

I am trying rename files in a directory which have a 2 digit number - i.e. any and all numbers from 10 to 99. I want to prepend a 0 so that for example 23 becomes 023, so that files like this ...
0
votes
5answers
90 views

Find all [filename].mp4 and rename [filename].audio [duplicate]

So I have a script that adds 2 films together using the audio from the $1.audio file. What I would like to do is rename any file in the directory with: *.mp4 To: *.audio Keeping original file ...
2
votes
5answers
126 views

Rename files not directories

I want to rename all files to lowercase in a directory without renaming subdirectories. I know rename function but it renames files and subdirectories which is not desired. Can you help?
3
votes
4answers
200 views

How can I pad lots of file names with zeros in a directory?

I just wrote a script that generated hundreds of files and stored them in a directory ~/foo. These files are ~/foo/X-file where X ranges from X=1 to X=900. My problem is that I would like to view ...
1
vote
2answers
64 views

Using rename to remove '.orig' from file and add '_1' to basename

I'm using a script to make backups of files, and to avoid overwriting files I've used cp --backup. Which leaves me with a number of files that look like example.mov.orig and test.mov.orig. I cannot ...
1
vote
3answers
72 views

Rename all files in directory while preserving any file extension

I have folder with about 1200 files that I need to rename. Theit file extension is .jpg, .gif, and .png for the most part. Here are some examples: Awesome\ FB\ \ (462).jpg Bonus\ FB\ ...
0
votes
1answer
92 views

c shell script: find the directory and rename it

i am still new in this shell script. I have a task that given to me which i have difficulty to execute it. The task is i have a lot of directory which is based on ddmmyy. 03Mar2014 08Aug2013 ...
1
vote
0answers
113 views

rsync + renaming the copied files

Is it possible to change the name of the destination file (add some timestamp as a prefix) when copy is done by rsync ? For example, I can use the following command to change the name of the ...
4
votes
3answers
538 views

“mv” file with garbled name by inode number?

I have several files with encoding issues in their file names (German umlauts, burned on CD with Windows, read by Windows and synced to Linux with Seafile. Something, somewhere went wrong...). Bash ...
0
votes
1answer
37 views

What is the barebones simplest way to recursively rename one extension to another? [duplicate]

I've done a fair share of googling and I've found some rather complex solutions. I feel as though there must be something simpler. Let's say I have ./1.txt ./2.txt ./more/3.txt ./more/4.txt ...
0
votes
3answers
84 views

Script for copying files from a folder and appending md5sum into new filename

I would like to know if this is possible: I have a large number of .mov files in a folder. I would like to know if I can copy the files to a separate folder but include the md5sum in the new ...
2
votes
1answer
111 views

Using rename command to rename first part of a file

I have three files in a directory (in mac-osx terminal) say INIT_Struc1 INIT_Struc2 INIT_Struc3 which I need to rename as FINAL_Struc1 FINAL_Struc2 FINAL_Struc3 When I use the rename command ...
9
votes
2answers
215 views

Is it possible to rename a file or directory using the inode?

I changed the /home directory to a different partition and couldn't access the files from it, something I have been able to solve from this question - How do you access the contents of a previous ...
0
votes
2answers
42 views

How to change ThisName@HostName ~ $

I am quite new to Linux and I was wondering how to change the following when in terminal permanently. When I set up my computer I used a name that I now want to change: In terminal, the name I want ...
1
vote
2answers
61 views

Rename files in bash script

I am writing a script to rename my files, The current syntax for filename is program 1.c and I want to change this to cprogram-program1.c. I am unable to get this format. Few conditions for ...
1
vote
1answer
39 views

Can I use the Rename utility to simplify this script that uses Find and Mv?

I use a script to automatically rename files according to a particular order: #!/usr/bin/env zsh pages=($(sed -n '/page_order/,/^$/ p' _config.yml | tail -n +2 | sed 's/ - //')) npages=${#pages} for ...
0
votes
3answers
57 views

Null value than rename file

I have a shell to a task but I should handle the null value in this. So in the task i cut the part of a word and i delete or rename the file, but need another if element for null. For example: I ...
0
votes
2answers
103 views

multiple files rename - filenames patterns [duplicate]

I have following image files in some directory which I want to be renamed: 8 -rw-rw-r-- 1 6661 sep 24 10:28 dbConnectionOkBostjan.png 8 -rw-rw-r-- 1 6548 sep 24 10:29 dbConnectionErrorBostjan.png 8 ...
-2
votes
1answer
51 views

Find part of filename

Please help with my task: I have a folder with three sub-folders containing six files each. There are two files in each sub-folder with :nopm in their file names. I need to create a shell script ...