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
2answers
80 views

Rename files in a directory

I have the files names as below in a directory example1.1.timestamp(.1457644337) example1.2.timestamp example1.3.timestamp and so on about 100 files. I need to rename all the files by removing the ....
2
votes
4answers
68 views

move a file that matches a pattern in a shell script

I have very little experience in writing shell scripts and need advice on how I can accomplish the following task. I need to move the most recent file in a directory where the filename matches a ...
1
vote
1answer
78 views

Rename multiple files in multiple directories to the name of the directory plus 1

I have been attempting to rename a bunch of files to their directories. I have multiple directories with spaces and no spaces /The Dark Tower. In it are multiple titles with file names with spaces ...
2
votes
3answers
213 views

Find and rename files (including directories) whose filenames contain space [duplicate]

I have quite a number of files and directories with spaces in their filenames in my ext4 filesystems. How should I safely find and rename them? I have bash and am running Ubuntu. Is it possible ...
1
vote
2answers
186 views

Renaming Files and Directories Recursively using rename/find

I started learning linux on vmware using centos 7. I created an image directory and several layers of files and sub-directories in that folder. most of the names containing spaces. I want to use a ...
0
votes
1answer
68 views

can mmv rename files by incrementing an index?

Can mmv, a mass move utility, nicely rename files from: foo.txt bar.txt baz.txt to: 1.txt 2.txt 3.txt The man page is intriguing, but I don't quite follow the directions: Rename all *...
0
votes
2answers
33 views

Bulk rename, change suffix? [duplicate]

How can I bulk replace the suffix for many files? I have a lot of files like NameSomthing-min.png NameSomthing1-min.png NameSomthing2-min.png I would like to change all them to NameSomthing.png ...
2
votes
1answer
51 views

Adding folder name to .zip files inside it

I have file1.zip, file2.zip, etc. in folder called folder1. have similar folders folder2, folder3, etc. I need to add folder name to each .zip file inside these folders. So, files inside folder1 ...
1
vote
2answers
63 views

How to remove prefixes and suffixes from filenames in a given directory?

I have many files with the same prefix and the same suffix. I want to remove both from filenames. Both contain spaces. So foo bar XXX doo par.jpg, foo bar YY YY doo par.jpg would become XXX.jpg and ...
-1
votes
1answer
17 views

renaming txt files

I have a list of files named like this SLX-11025.N701_N504.C8912ANXX.txt And need to rename them based on this small part N701_N504, and each will be renamed to an specific code (for example - ...
1
vote
4answers
51 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 $...
1
vote
2answers
30 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 ...
2
votes
2answers
55 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
91 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 's/\(bar\)_\(foo\)/\2_\1/g',...
2
votes
4answers
185 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
72 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
220 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 DJ-...
0
votes
1answer
17 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 {Action}{Adventure}{Thriller}{...
1
vote
3answers
87 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
63 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
45 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
573 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 splitfile[...
5
votes
5answers
528 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
71 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
155 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
22 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
193 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
29 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
31 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
497 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: http://stackoverflow.com/questions/1806868/...
3
votes
1answer
110 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
84 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
62 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
108 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 etc....
-2
votes
2answers
82 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 01-...
1
vote
5answers
130 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
66 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
44 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
37 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
528 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
157 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
26 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
187 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
204 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
250 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
98 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
137 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
182 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
482 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
1k 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 ...