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
1
vote
0answers
26 views

scripting: how to cp (or rsync) same files (and filenames) with autorenaming and mantaining .ext

I want to write a simple bash script (for loop). After obtaining a list of wanted files, eg:find /start/* -iname "*.txt" > txt.list I'd like to copy all of them inside an unique destination with ...
0
votes
0answers
24 views

Find and Add timestamp to the filename prefix only to files in same Directory

I'm using the following script to find all the PDFs sitting in directory Dir1 to add the timestamp to the filename prefix and drop it in same Directory. Seems to be working well the only thing is if ...
0
votes
3answers
45 views

Renaming files by removing delimited substring

I have a lot of folders and subfolders with files with name 1. Introduction--- [ FreeCourseWeb.com ] ---.mp4 I want to rename all files recursively (folders and subfolders) to just 1. Introduction.mp4 ...
2
votes
3answers
91 views

Pad file names so Unix lists them in numerical order

I have a folder with several files formatted as follows: C Block Scan copy 1.pdf C Block Scan copy 2.pdf C Block Scan copy 3.pdf C Block Scan copy 4.pdf . . . One issue I'm having is that when I run ...
-1
votes
1answer
41 views

Cycle in bash - syntax

What is wrong here? for file in ffn* do; rename 's/ffn//' ffn*; done There is an error in syntax.
0
votes
1answer
41 views

ERROR. Rename files AND DIRECTORIES with windows reserved characters

I had a hard drive that couldn't mount on Linux Mint and to fix it I had to go to Windows and do chkdsk /f e:. chkdsk fixed the problem but it renamed every file with special characters and moved ...
0
votes
0answers
68 views

Rename files and directories with windows or linux reserved characters [duplicate]

I want to recursively rename files and directories from the current directory. The characters < > : " \ | ? * / should be removed. Also remove the spaces at the start and end of a filename. This ...
0
votes
2answers
44 views

Removing a single character from the beginning of file names

File names : _10_-_Overriding_or_customizing_the_rest_end_point-rkkfgI502f0.mp4 _11_-_Expose_ids_in_json_response-CrDXtLfiZos.mp4 _12_-_Create_angular_8_project_using_Angular_CLI-kSXkW1hF0KU.mp4 _13_-...
0
votes
1answer
36 views

rsync failed - no such file or directory - script works since 8 years(!)

Using Debian and Apache2 webserver: I have a cron job, that makes a two different db_dumps, and then saves all files from the website (www) to adrive.com and also the db dump to a drive in a 2nd ...
1
vote
3answers
51 views

renaming video files in bulk taking input from a playlist file

Files in directory : $ ls | sort -n 1.mp4 2 .mp4 3 .mp4 4 .mp4 5 .mp4 6 .mp4 7 .mp4 8 .mp4 9 .mp4 10 .mp4 A list of file names in a playlist file : $ cat playlist.m3u8 1- Introduction-OxIDLw0M-m0....
8
votes
4answers
2k views

Renaming a file in Bash using regular expressions

I have a file named 35554842200284685106000166550020003504201637715423.xml and I simply need to rename it to 42200284685106000166550020003504201637715423.xml (remove everything before the last 48 ...
0
votes
1answer
22 views

Stripping portion of file names

Example files: 1_this is_file one-xhdjsnsk.mp4 2_this_is file two-hdksbdg.mp4 3_this is_file three-hsislnsm.mp4 4_this is file four-gwywkkd.mp4 How do I strip everything from '-' to '.' so the ...
0
votes
2answers
28 views

Copy files with the same name but in different dirs into a new dir while renaming them

I have the following directory structure: top_dir |________AA |_______f1.json |_______f2.json |________BB |_______f1.json |_______f2.json |...
1
vote
2answers
26 views

Rename folder name in Fedora

I am using rename in Fedora 31 to rename some bulk of folders. Essentially, I want to remove all the spaces from the folder and replace it with dots. I am using following command rename -v " " "." * ...
0
votes
2answers
35 views

Rename recursively exluding the current directory

I use this command to rename files recursively: find -iname \*.bak | rename 's/.bak/.old/' But I want to exclude the current directory. Example: .bak dir1/.bak dir2/.bak ... After I want this: ....
1
vote
1answer
23 views

Replace chars in multiple files in multiple directories

On my Qnap I'm trying to replace "xyz" in filenames to "abc" in files in multiple directories. Being a unix/linux newbie, i tried the following command: for f in *xyz*; do mv -i "$f" "${f//xyz/abc}"; ...
0
votes
2answers
44 views

Replace single spaces and hyphens between spaces in file names

I have a bunch of files named like this: File one - some name - 01-05-2020 File two - some name - 01-07-2020 File three - some name - 01-15-2020 What I need is to replace: Single spaces with ...
0
votes
2answers
41 views

How to bulk rename files to add modification date? [duplicate]

I have these files, which were modified today and yesterday, respectively: a.txt b.png And I want them renamed to: 2020-02-01.a.txt 2020-01-31.b.png How to do that in a single Bash command?
1
vote
1answer
28 views

Compare name of files to a column in a table and if a correspondence is found rename it according to another column

I have an extensive set of files in a directory (in bash) that are named (inconveniently) as follows: COMMONSTUFF_X_Y_**VARIABLE-IDENTIFIER**_COMMONSTUFF I also have a table in which one column ...
0
votes
3answers
90 views

Renaming all files in a directory with a numerical sequence based on time created

I am trying to rename all files in a directory, for example, ~/folder/ contains(from newest to oldest): apple.foo, pie.foo, cookie.foo, melon.foo renaming them with a fixed prefix and a number of ...
2
votes
2answers
141 views

Script to recursively replace invalid characters in filenames, not directories, with rename

I'm looking to write a script that will find and replace any characters other than [^A-Za-z0-9._-] in a specific file type (in this case .avi) with an underscore _. I want this to exec recursively ...
0
votes
1answer
29 views

Copy all files in folder to another folder appending a . to the file name and rename it back to original file name

after searching and trying various way I couldn't get it work. I need to copy lots of files (more than 100 thousand files) to another folder with dot appended to the start of the file name. Example: ...
0
votes
1answer
53 views

Using sed with a variable in the pattern

I am trying to rename a couple of files with the same extensions with a differing variable in the middle. I have tried the following with no luck as to what I wish to accomplish. file: ...
0
votes
1answer
95 views

Flattening directory and renaming files incrementally (MacOS)

Looking to flatten the directory (with duplicate child file names) while renaming all files, keeping duplicates OR appending all file names with an incrementing number (incrementing # + name would be ...
1
vote
2answers
19 views

Rename numbered files while keeping text

I am trying to rename a set of files. The files have this form frame\[d]+_object.bin I have files numberes from 1 to 1500, and I want to rename only the ones between 100 and 199 I have tried the ...
1
vote
1answer
18 views

Mass renaming files that have patern sql_^d^_migration.sql

I have the following list of files on an Ubuntu system: sql_1_migration.sql sql_2_migration.sql sql_3_migration.sql ... sql_100_migration.sql sql_1000_migration.sql ... And I need to rename it ...
0
votes
2answers
45 views

Remove '?' character from many filenames in a single directory

I have many files in a directory that have names containing ?, and I want to remove these ? characters. Could you please help me with that?
0
votes
1answer
29 views

How can I rename multiple files within a single directory, to remove the timestamp at the end of the file name?

How can I rename the files below on Linux to remove the time stamp from the file name? AB_CD_EFGHIKL_20191221_D_1.dat.20191221102446_processed AB_CD_EFGHIKLMN_20191221_D_1.dat....
0
votes
3answers
44 views

Unix pipeline of rename commands

Is there a way to get the rename command to print JUST the output file name (not the XXX renamed as prefix or the brackets)? I'd rather not use regex unless that's the only choice. Why I'm asking: I ...
0
votes
1answer
39 views

How to add a period to all files starting with a certain pattern in terminal?

I have several files all starting with the name template_file template_images I want to make these files hidden by adding a period before all of them. What is the terminal command line I can use to ...
4
votes
6answers
160 views

Rename files by reversing number order

I have a lot of files that are named like: data1_1.txt data1_2.txt data1_3.txt data2_1.txt data2_2.txt ... However these were downloaded and named in the reverse ordering. How could I rename all of ...
0
votes
1answer
51 views

find special character (ASCII 249) and rename files, folders and subfolders in a directory

I'm looking for a find and rename command to rename all files, folders and sub-folders in a directory containing ASCII-Code-249. For example: Ga¨rten should be Gärten. So rename all a¨ to ä.
0
votes
1answer
73 views

rename fastq.gz file name

I have hundreds fast.gz files, and they have the same format of file name: 5809029_GWU_DNA_269_L001_R1_001.fastq.gz 5809030_GWU_DNA_269_L001_R1_001.fastq.gz How do I change the first and the second ...
1
vote
1answer
22 views

BASH: Renaming and organizing files based on information in the filenames

Suppose I have a bunch of files has information separated by underscores: nickname_username_realname_date_filename.txt I want to make a directory for each username and rename the file to get rid of ...
0
votes
3answers
58 views

Linux Bulk file renaming at specific position

I want to rename all the files in the directory at specific position. Original File sample Names: neif11_fastcredit_20190629101333.txt neif11_fastcredit_20190629101334.txt ...
0
votes
2answers
57 views

Copy all files from subdirectories and subsubdirectories to main directory with modifying file names by adding prefix of all parent directories

Following these two posts: https://askubuntu.com/questions/871898/move-files-to-parent-directory-prefixing-file-name-with-former-subdirectory-nam https://askubuntu.com/questions/870844/recursively-...
0
votes
0answers
47 views

Recursively Find and Copy All PDF files from HDD to a Local Folder

I'm trying to copy all PDF files in an HDD to my computer, without losing any PDF files with different content but the same name, i.e. if I have 3 folders folder1, folder2 and folder3, each with a ...
0
votes
1answer
23 views

Renaming file, single character

Is there a shorter way to rename a file when you only want to swap out one character? Essentially, I'd like to rename alex_is_my_best_pan.txt to alex_is_my_best_pal.txt without having to type: mv ...
1
vote
1answer
70 views

Attempting to Rename files based on text files

I am attempting to rename a directory full of files based off the contents of two text files. OLD (which has the full names of the current files) and NEW (which has the names i wish to rename them) ...
-1
votes
1answer
33 views

Mass file rename

I would like to mass rename/remove spacing between all my files as below: TO Basically I want to remove the spacing between SXX EXX on all files in the directory. The other files are named different ...
0
votes
3answers
58 views

Mass file renaming from from text file

I have a folder with about 7,000 files and each file is numbered e.g. 74857.mkv 74858.mkv etc. I also have a text file which has all the file numbers and file names: In this order: I would like to ...
2
votes
3answers
47 views

How to Update rename Command

My current rename command version is 0.20 $ rename -V /usr/bin/rename using File::Rename version 0.20 I want to update it to 1.10 or higher. How can I do that?
2
votes
1answer
118 views

Not Renaming Child Directory When Parent Directory is Renamed

My directory tree is like the following - /media/blueray/Data/Test$ tree . ├── What???? │   └── What???? └── What????.txt When I run the command find . -depth | rename 's/[?<>\\:*|\"]//g' It ...
2
votes
2answers
129 views

Error with rename command

I have an issue to rename the following file -data-02-03-04.dat I guess the issue come from the file name which starts with a dash. I get the following error trying to rename it. rename -data-02-03-...
0
votes
1answer
36 views

Copy and rename files adding a dynamic prefix/suffix

I need to copy some files that are like this: folder1/name1.csv folder1/name2.csv folder2/name1.csv folder2/name2.csv folder3/name1.csv folder3/name2.csv All folder* are subdirectory of a directory. ...
-1
votes
1answer
27 views

Shortcut in mv command to rename file without changing its directory [duplicate]

I would like to be able to do this mv /long/path/to/file/old.txt /long/path/to/file/new.txt without typing the directory twice. I imagine something like rename /long/path/to/file/old.txt new.txt ...
-1
votes
1answer
23 views

Replace character at specific occurrence

I have a bunch of files.. Here are a few. Hundreds more. 2019-02-08-07-32-00_UM8305_H.PDF 2019-03-17-17-59-59_UM8305_H.PDF 2019-05-05-23-59-59_UM8305_H.PDF 2019-07-08-12-31-57_UM8305_W.PDF 2019-...
0
votes
2answers
69 views

Can you conveniently rename a file without changing directory?

Is there a convenient way to rename a file (or dir) without redundantly repeating the path or directory-changing to it? For example … mv -some_flag db/migrations/abc_201911201243.php ...
1
vote
0answers
21 views

using rsync to move merge files into new directory fails to show progress or create backups

I have a bunch of old backups, each of which is a directory containing incremental changes from the previous backup. There are arbitrarily nested directories and files in each directory. I need to ...
1
vote
1answer
61 views

Batch rename “case duplicates”

Regarding this problem and answer: https://unix.stackexchange.com/a/188020/189709 for f in *; do mv --backup=numbered -- "$f" "${f,,}"; done rename -v -- 's/\.~(\d+)~/$1/' *.~*~ mv: This command ...

1
2 3 4 5
20