Questions tagged [rename]

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.

Filter by
Sorted by
Tagged with
0
votes
1answer
228 views

Command line to change file names

I have a large number of files which I would like to rename. Here is an example of how I would like to change the file names: From: PD5 grey nice display 1.jpg To: pd5-grey-nice-display-showcase-1....
0
votes
2answers
61 views

Renaming multiple files with 2 consecutive periods within name

I need to use the rename command to rename hundreds of files which contain .. (2 periods) within the filename and change .. to - (hyphen). The fact that it contains periods seems to be confusing the ...
2
votes
0answers
411 views

udev iw add interface rename issue

I need to put wifi interface into additional monitor state. If I don't use udev rule and wifi interface named by kernel as wlan0 (default): $ iw dev wlan0 interface add mon0 type monitor in this ...
0
votes
2answers
119 views

Rename characters within a specific file using find and variables?

I have a file that looks like the following: /var/www/html/media/2018@03@01@vi_0005_20180301_110203.h264.v0005.th.jpg. I would like to find this file in /var/www/html/media and rename h264 to mp4 ...
0
votes
3answers
251 views

Find and replace a string in a batch of files but do not create any filename conflicts

I have a directory tree with a few thousand files collected over the years with random and useless file names. I want to clean them up, keep them relevant, remove certain words but also not create ...
0
votes
2answers
457 views

UNIX foreach and sed commands!

I have 7 csv files which have some climatic data. The name of the files are: SMVV50065-2015-01.csv and *2015-02.csv, 2015-03.csv etc. When I open the csv files I see a syntax like this: " SMVV, 2015-...
0
votes
2answers
1k views

How to rename multiple files using find and rename

I want to take out .hs from all files. Why this command doesn`t work properly? It leaves the same name of files. find . -type f -exec rename .hs ' ' * \;
0
votes
2answers
163 views

Renaming a list of files from a text file

I have a folder containing these list of files. lesson1.mp4 lesson2.mp4 lesson3.mp4 lesson4.mp4 I`m trying to rename this files based on contents of "rename.txt" 1. Introduction to the React ...
0
votes
4answers
615 views

How to remove `_` from all file-names in a directory

In bash, I have an unzipped directory where I have many file names that start with _. I'm pretty sure I can use rename or mv to simply remove the _ prefix of each file that has it. I try: for ...
0
votes
2answers
36 views

rename filenames recursively to simpler name [closed]

my file names look like: A06_S6_L001_R1_001.fastq A06_S6_L001_R2_001.fastq B07_S6_L001_R1_001.fastq B07_S6_L001_R2_001.fastq C08_S6_L001_R1_001.fastq C08_S6_L001_R2_001.fastq and I want: 1A06.R1....
0
votes
5answers
91 views

Rename a HTML file based on the content of a tag

I have a lot of html files that I want to rename according to the content of the tag h1. Any suggestion on how to do it on bash? Example of a file: <!DOCTYPE html><html lang="pt-BR">&...
0
votes
4answers
37 views

Find and unmark marked files using string compare?

In bash, I have a script that a uses while loop to copy files in a certain folder to various different directories. After each file is copied, I've written mv $dir/$file $dir/_$file using _ in the ...
1
vote
0answers
615 views

Change visible OS Name

I have a Linux Mint 18.3 installation that I have heavily modified. I'm wanting to change the name of this installation so to a normal person, it isn't Linux Mint, but some other weird distro (cause ...
-2
votes
1answer
63 views

Script to rename specific part of the filename with another file name?

Contents of folder /home/User/Desktop/DR dr_subject00001_Z.nii dr_subject00002_Z.nii dr_subject00003_Z.nii ... and so on (increments by 1 up until the number 40) Contents of folder /home/User/...
1
vote
3answers
112 views

remove first characters if its “0” from all files

i have few folder: 1 2 3 4 5 so in each folder i have files like 00123.mp3 00133.mp3 00150.mp3 so i want to remove all 0 if they are at beginning of filename i tried this for file in *; do echo ...
1
vote
4answers
425 views

How to rename files with different extensions

Say I have these files: essay.aux essay.out essay.dvi essay.pdf essay.fdb_latexmk essay.tex essay.fls essay.toc essay.log ...
2
votes
3answers
44 views

apply a script across a tree of subfolders

I need to apply the following script across a tree of subfolders but unsure how I should call this script so it is performed on every subfolder in the tree. I only have to do it once. Thanks in ...
1
vote
3answers
778 views

Rename files but retain files original time stamp in name

I have a list of a few hundred files. They are currently as below: filename.New_20160901.dat filename.New_20160902.dat ... etc., all the way up to filename.New_<current date>.dat I have a ...
0
votes
1answer
129 views

Find latest folder/file version and remove - no time stamp data

I have data recovered from a backup and the data recovered has multiple versions of the same folders/files. The folders/files have been named with _000 _001 _002 etc on the files and folders. All ...
2
votes
2answers
383 views

How can I strip out a numeric prefix from multiple filenames?

I have >2000 files which are named like 123-FILENAME_TEXT_M101K_20150929.CSV where 123 can be any three or four-digit number. The files are all within the same directory. I would like a script that ...
2
votes
5answers
6k views

Batch rename files to a sequential numbering

I am trying to batch-rename a bunch of files in my shell, and even though there is plenty of material about it on the internet, I cannot seem to find a solution for my specific case. I have a bunch ...
2
votes
1answer
170 views

Move command to transfer all files in a subfolder to parent directory and rename if there are files with same name

So I have a directory that has 77 subfolders in it on my Ubuntu machine, each with various amounts of torrent files in them. Total of 427 torrents are contained in the subfolders. I want to move all ...
1
vote
1answer
386 views

Problem with “rename” using regex (Linux)

I have a backup script which is creating two files: a) db_mywebsite_2018-01-10_00-25.sql.gz (150 MB) b) mywebsite1_2018-01-10_00-01.tar.gz (2 GB) I want to remove the date (XXXX-XX-XX_XX-XX) from ...
0
votes
1answer
78 views

Renaming multiple files by matching variable words in a directory [closed]

I've multiple files in a directory and I want to rename it and only remove matching words from the file name. Example files: 8 - build a php mvc application - finished (part 8_9).mp4 9 - build a php ...
1
vote
3answers
992 views

Batch renaming files from Terminal

I have some .mp3 files that have trailing $ signs in the extensions which I want to remove, they are named: 1.mp3$$ 2.mp3$$ etc. and they must be 1.mp3 etc. I tried for f in *; do a="(echo $f | ...
4
votes
3answers
5k views

How to replace a string in all folder and file names [duplicate]

How can I recursively replace a string in all folders and files' name with a different string? I am running Red Hat 6 and I can find them with: find . -name \*string\* I've managed to do it for ...
0
votes
1answer
425 views

How can truncate a file name after a certain character

Due to limited knowledge of wget I have a bunch of files with names like: doc1.pdf@uselessjunk doc1.mobi@uselessjunk How can get to just the filename before the @ symbol? There are multiple ...
0
votes
1answer
137 views

What does the command “rename * *.log *” do?

I am running Red Hat 7.3. I typed in rename * *.log * with the hope of removing log from the names of all files. I don't this has been happening, and in short, I think somehow files are disappearing....
0
votes
5answers
803 views

find Command along with grep and mv

I have many files in a SRC folder. I would like to move all the files that follow a particular pattern from this SRC folder to another DST folder along with rename the file with a required extension. ...
5
votes
3answers
2k views

Remove characters from file names recursively

I have hundreds of directories, some nested in other directories, with tens of thousands of files. The files need to have a date/time stamp removed from them. An example filename is Letter to Client ...
1
vote
2answers
1k views

bash rename files in directory using regex

Currently I have the following bash script that does a for loop in the directory: for filename in *-example99.jpg do width=$(identify -format "%w" "$filename") myVar="newName$width" new=$(...
0
votes
2answers
278 views

How to use the bash shell parameter expansion for filename manipulation

I would like to rename a list of MP3 in the same directory like : 001 - toto1.mp3 002 - toto3.mp3 003 - toto5.mp3 004 - toto7.mp3 005 - toto9.mp3 toto10.mp3 toto35.mp3 toto59.mp3 toto75.mp3 I tried ...
3
votes
3answers
2k views

Count number of columns in CSV files and rename if less than 11 columns

I need to count the number of columns in CSV files. If less than 11, rename the file appending the .bad suffix. I tried this but it's short of what I need: head -1 myfile.csv | sed 's/[^,]//g' | wc -...
0
votes
1answer
147 views

Krename: how to restart numbering for every folder?

I have 4 folders with 3 folders each. after the rename operation, I will have folder1 - file1.txt - file2.txt - file3.txt folder2 - file1.txt - file2.txt - file3.txt and so on. When I ...
0
votes
0answers
77 views

Old rename was better for me

Debian now has a new rename that is different from the old rename written in Perl. Is it possible to install, aside of new rename, the old one? Which steps should I perform to install the old rename? ...
1
vote
2answers
42 views

Dropbox-Daemon crashes after renaming username

After I renamed my username in Linux Mint as described in this article, my Dropbox-Daemon allways crushes. Done renaming process: Ctrl+Alt+L Ctrl+Alt+T ~$ exec sudo -i ~$ killall -u oldname ~$ id ...
0
votes
1answer
127 views

Bulk rename (append) CSV files based on a value within

Is there a way to rename a batch of CSV files in a folder based on a value within each? I want to take the first value on the second row and append it to the end of the left-hand side. For example: ...
5
votes
2answers
263 views

Find files with similar names, delete the oldest, rename the most recent

I have this situation where there's a lot of files with similar names (but they all follow a pattern) in different subfolders file1 file1 (Copy) /folder1/file2.txt /folder1/file2 (Copy).txt /folder1/...
2
votes
1answer
60 views

Reorder path elements of a directory tree

I have a directory tree where the path elements correspond to specific properties of the file at a particular path. For example, something like this: $ tree . ─ a ─ 1 ─ y ─ 334f │   │   └── z ─ 6410 ...
3
votes
5answers
4k views

rename files to change spaces to underscore

I have a load of files(mp3, wav, txt, doc) that have been created in MS Windows and they have spaces in their names. eg The file of whoever.doc I would like to rename them all at once, replacing the ...
0
votes
1answer
32 views

Removing part of a bunch of directory names using a wildcard

I am trying use unix to remove the last part of the names of a series of directories. Here is an example of the naming structure: s23987_11.09.16_hf_0001 s29485_03.04.07_hs_0005 s39854_01.01....
2
votes
3answers
1k views

Renaming: Remove last X characters from files in directory

I'm trying to rename a lot of videos downloaded via youtube-dl from various sources. As you may know, yt-dl will append the view code to the file name. E.g. Video Title-dQw4w9WgXcQ.mp4 I'm ...
1
vote
1answer
449 views

strange character in file name

I usually name papers by copying/pasting the paper title name from a pdf file. For instance: peng2017-Induction of the pho regulon and polyphosphate synthesis?against spermine stress in Pseudomonas ...
2
votes
1answer
220 views

How to copy and add prefix to file names in one step from another directory?

I want to copy and rename multiple files from one directory to another. Particularly, I want something like this: /tmp/tmp.XXX/aaa.original.txt /tmp/tmp.XXX/bb5.original.txt /tmp/tmp.XXX/x2x.original....
1
vote
3answers
89 views

How to change files with a specific word to end in.fasta

How do I select and change files that have a specific word in it to all end in ".fasta"? For example I'm selecting files with the word "car" in it. find /home/user -name "*car*" which gives me /...
4
votes
3answers
2k views

Rename files using a WHILE loop instead of a FOR loop

Consider we have many photos with names like DSC_20170506_170809.JPEG. To rename the photos so that they follow the pattern Paris_20170506_170809.JPEG, I've wrote the following script that works ...
0
votes
1answer
382 views

How to use rename command with printf

As I was trying to fix the episode numbers of a TV series I toyed with the rename function and trying to pass the return from printf as the rename parameters, but could not do it. I tried just about ...
0
votes
1answer
313 views

Invoking zmv from bash

I have recently discovered this technique for renaming files using zsh: autoload zmv zmv '(*).JPG' '$1.jpg' which I can also write as: autoload zmv; zmv '(*).JPG' '$1.jpg' This works as advertised ...
5
votes
1answer
633 views

How to rename filenames with accents on macOS?

I am trying to rename files that include the character "à". I do the following : rename -v 's/à/a/g' * But it shows all the files as unchanged. Verbose mode shows the same thing. I tried to escape ...
0
votes
4answers
1k views

How to remove nth character from set of filenames?

Hi I am looking for a bash solution to batch file renaming. I have files acquired from a digital camera I am importing as time-lapse footage. Every 1000 images the JPG file renaming jumps as such: ./...