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
0answers
43 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
68 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
79 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
126 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
65 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
30 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
27 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
396 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
146 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
24 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
137 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
160 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
225 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
83 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
111 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
139 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
297 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 ...
0
votes
1answer
45 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
121 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
137 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
411 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
52 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
76 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
40 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
62 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
127 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
59 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 ...
0
votes
1answer
38 views

Replace some characters in a certain part of a filename

On Solaris, I've got a script that succesfully do that: USER,REPORT_NAME,DD:MM:HH24.pdf -> USER,REPORT_NAME,DD_MM_HH24.pdf The one-liner is this: for f in *:*; do mv "$f" $(echo "$f" | tr ':' ...
1
vote
1answer
29 views

How to recursively add zeroes to a file name [duplicate]

I have a folder with these files: 03.jpg 04.jpg 05.jpg 99.jpg I want to rename these files to 003.jpg 004.jpg 005.jpg 099.jpg by using a bash script. How can I do this?
4
votes
2answers
68 views

bulk renaming files to their folders name

I have a folder structure like that: 'Pictures/2015/2015-01-02/random_name.jpg' and I want to rename the files to '2015-01-02 001.jpg', '2015-01-02 002.jpg' etc. I'm not really familiar with bash ...
3
votes
3answers
561 views

How to rename multiple files to their contents' MD5 sum?

I would like to rename some files to their contents' MD5 sum; for example, if file foo is empty, it should be renamed to d41d8cd98f00b204e9800998ecf8427e. Does it have to be script or can I use ...
5
votes
5answers
222 views

Renaming files using list

I have files available in a directory as: filename15_1 filename15_2 filename15_3 filename15_4 And so on. I have another file that contains mapping information for how I want to rename the files. ...
10
votes
1answer
280 views

What's with all the renames?

On my Debian system (well, my LMDE system, but close enough), I have at least 3 different rename programs: /usr/local/bin/rename : This is a Perl script, written by Tom Christiansen. Oddly enough, I ...
1
vote
2answers
54 views

Why doesn't the rename command work as expected?

I have some files like: 1_suffix.txt 2_suffix.txt 3_suffix.txt I want to remove the _suffix.txt in them. I found a command called rename and use it as: First I tried: rename -v ...
0
votes
2answers
83 views

rename multiple directories by adding one character [duplicate]

I have multiple folders named as follow: Name1 Name2 ... Name9 Name10 Name11 ... I need to rename them using mv command into: Name01 Name02 ... Name09 Name10 Name11 ...
3
votes
5answers
60 views

How do I exchange names for a large amount of files in a folder?

I want to randomize the names for about 350 files in a folder, but I want to have all the names that the files had originally. What I mean is I want All of the names in my folder randomized from the ...
0
votes
2answers
38 views

mv files into folders based on numbering in names

I have 30 folders: s-01 s-02 ... s-30 And, I have 30 files: txtFile-001 txtFile-002 ... txtFile-030 How can I perform the following operation in one shot mv txtFile-001 s-01/txtFile mv ...
0
votes
1answer
41 views

Bulk rename files - remove space

I have hundreds of files in a folder named transactions 1.csv, transactions 2.csv, transactions 3.csv etc How do i remove the space in the file names, so they become ...
1
vote
1answer
45 views

Rename file names extracting pattern from them

I have a list of file names abc1.doc, abc2.doc and so on. Always in the form text[number].doc. I want them renames to [number].text.doc. How can I do this?
0
votes
3answers
63 views

Rename files in directory according to name of directory

I am trying to rename a bunch of files according to the names of their directory in Linux, SSH. I have a directory called XYZ01smith. In it are four files called smith_5*.I need to add prefix XYZ01 ...
1
vote
1answer
105 views

Batch renaming of files with ascending number

I have a batch of files: $ ls Li1Fe1O2_11 Li1Fe2O3_8 Li1Fe3O4_2 Li1Fe3O4_5 Li2Fe1O3_16 Li2Fe2O4_12 Li3Fe1O4_19 Li3Fe1O4_22 Li1Fe1O2_14 Li1Fe2O3_9 Li1Fe3O4_3 Li1Fe3O4_6 Li2Fe1O3_17 Li2Fe2O4_13 ...
1
vote
1answer
36 views

Using rename in the terminal to remove not accepted Windows characters

I have a folder full of files. Some of these files contain characters in their name that are not allowed by Windows. How can I use the command rename to find, and eventually remove all these ...
0
votes
2answers
77 views

Bash script that removes part of a filename in every file under a directory

I have several files under a directory whose names are of the form *.foo.bar. I would like to write a bash script to rename each of these files by removing the .foo part. For example, suppose that ...
1
vote
3answers
218 views

Copy filenames, and add path prefix, in a directory, recursively

I have a working directory: /home/myusername/projectdir The working directory contains files and sub-directories. The depth of sub-directories is not known. I want to put all the *.log files into the ...
2
votes
2answers
233 views

Batch rename according to number of pages in pdf file

I have a lot of papers in pdf files (and also other type of files in the same folder). I'd like to rename them using the pattern <current file name>[<number of pages>].pdf But after ...
0
votes
2answers
69 views

Rename the bunch of files with a specific pattern

I have number of files with following name details.. 2007-07-22-2300-11S.NAN___024_ABI___HH_E_SAC Where: 2007-07-22 is date. 2300-11S is hhmm-sec. NAN___024 is network same for each file (not ...
4
votes
3answers
168 views

How to remove space in all sub directories in shell script?

I tried following shell script to remove all spaces with underscores: find $1 -depth -name "* *" -print0 | \ while read -d $'\0' f; do mv -v "$f" "${f// /_}"; done If I have a directory ...
7
votes
2answers
3k views

How to replace spaces in all file names with underscore in Linux using shell script?

I tried following shell script which should replace spaces from all xml files for xml_file in $(find $1 -name "* .xml" -type f); do echo "removing spaces from XML file:" $xml_file mv "$xml_file" ...
0
votes
1answer
107 views

How to append extension to files with certain filename format

I have several files generated by a script but I neglected to have the script append a file extension. Each filename contains the substring k120 and no other file in the directory contains that ...