Skip to main content

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
-2 votes
1 answer
27 views

Is there a port of the Windows' REN command for Unix-like operating systems? [duplicate]

I already know the "rename" command in GNU/Linux. However, it is very complicated and cumbersome because it uses regular expressions. For example, in Windows, I can simply rename files in ...
TranslucentFoxHuman's user avatar
0 votes
2 answers
79 views

How to write an alias or bash script that renames a single file using the same syntax as the `ren` command of Windows?

I am a long-term a Windows user, so I find the syntax of the ren command both simple and convenient: ren C:\pathTo\myFile\oldFileName.txt newFileName.txt I want to be able to use the same syntax on ...
ps.pf's user avatar
  • 3
2 votes
1 answer
98 views

removing hidden control characters in filenames

I have a huge number of files spread across a large directory structure that have hidden control characters in their names. ls lists them as, e.g.: '614.7-4-F1-00-090-007-RozvadØ'$'\302\237'' RP1-...
atapaka's user avatar
  • 611
3 votes
1 answer
163 views

changing uuid of /run/media/root/ partition

I have a usb disk and after formatting it shows up as /run/media/root/abc213 where abc123 is some much longer complex string that no normal person would be able to remember... typical of what you ...
ron's user avatar
  • 7,239
0 votes
2 answers
50 views

How to loop through multiple subdirectories and change file extension

I was assigned to manage a legacy codeIgniter 3 code base. There is this error that the website doesn't load images that are .JPG. Rather than making it not case-sensitive we want to change every .JPG ...
Džiugas Balčiūnas's user avatar
0 votes
1 answer
25 views

Renaming across devices when destination already exists: is EXDEV guaranteed?

I am calling rename(2) with "old" and "new" paths on different devices. Am I guaranteed that the error code will be EXDEV, or can other error conditions take precedence? ...
Simon Richter's user avatar
0 votes
1 answer
27 views

How do I change a specific character in mutliple file names. The character can be at any location in the file name [duplicate]

OK, I have some files that have a character such as - at different positions in their name. I want to change - to lets say _ Is it possible via a command line Example of file names one-test.pdf test - ...
Newbie_New's user avatar
0 votes
1 answer
80 views

Why does find ....-execdir rename miss files? zsh

I'm using zsh on MX Linux 23.2. For years I have tried to figure out why a command like find . -depth -type f -execdir rename 's/_720p//' {} \; skips over files. I know my file manager can't be ...
Terry 's user avatar
  • 35
1 vote
1 answer
63 views

Find files by extension and replacing characters before and after the search pattern

I need to find a files by extensions and replace the random characters before the search pattern to the specified text (REPLACED), turn the numbers after this pattern into an increasing counter and ...
anc's user avatar
  • 11
3 votes
3 answers
72 views

Rename batch of pictures with a very specific format

I have about 4k pictures with this format: photo_6923@06-01-2022_14-18-36.jpg photo_6924@07-01-2022_00-03-23.jpg photo_6925@07-01-2022_01-36-20.jpg photo_6926@07-01-2022_10-44-20.jpg photo_6927@07-01-...
Nix Chaotian's user avatar
2 votes
3 answers
508 views

I want to replace periods in a directory name

Everything I am finding online is failing at this. Im using unbuntu 2204 and trying to write a bash script to replace the periods in my media library directory names. The newest script I found was 4 ...
Anthony Mataraza's user avatar
2 votes
6 answers
567 views

Convert EPOCH string in filename to readable format

My knowledge of Unix is not very good. I'm trying to write a shell script to rename a set of files in a directory, like 1709532255.mp4 to 20240304_070415.mp4, where 1709532255 is always an epoch time. ...
tom's user avatar
  • 23
0 votes
2 answers
48 views

linux find and rename items with backslash not working as expected

I have tried a couple of approaches to find and rename some files that hold a backslash (mind you these files generated from a web app do not have the quoets) in a directory. I've tried with find and ...
gstlouis's user avatar
0 votes
2 answers
81 views

Remove invalid characters from recursive Linux filesystem

I have a huge filesystem full of folders/files using invalid characters. I have found one command that almost does what I want and it came from this thread - https://stackoverflow.com/questions/...
JandP's user avatar
  • 1
1 vote
2 answers
51 views

Numbering files and restart for every folder in command line?

I use a little script to numbering files. I start it with a thunar custom action. This only works when all files are in the same directory. the new files name are 00001.ext to 00005.ext when I rename ...
fmeier's user avatar
  • 331
0 votes
3 answers
96 views

Rename multiple files in directory - Using sed or rename command

I have tried so many different sed, mv and rename commands - still I cannot rename these files. There are 50 plus files - I tried commands I found - Help thx Original filenames: PAGES_TEST1_SART1.XML ...
mattandbeyond's user avatar
0 votes
1 answer
48 views

Used mv instead of rename; files gone

While trying to batch rename a bunch of directories with rename 's/foo/barr/g' * I carelessly got mv in there instead of rename (mv 's/foo/bar/g' *), which seems to have cleared out the directory. But,...
devnulljp's user avatar
6 votes
3 answers
383 views

zmv: Replace double-quote (") in filename

Using zmv on macOS, I'd like to replace double-quotes (") in filenames with underscores (_). However, I'm having trouble getting the zshexpn to correctly isolate the ". Is there some magical ...
atlauren's user avatar
0 votes
2 answers
125 views

Rename command seemed to remove a bunch of files. Can I recover them?

Using Ubuntu 22.04 I had a folder with a bunch of files I wanted to change the file extension so I used: rename 's/\.zip$/\.cbz/' *.zip The command completed without throwing any errors, but I found ...
image_muck's user avatar
3 votes
3 answers
147 views

Rename directories by removing part of a dir name

Have lot of directories like the following ./parent/inventory_control-8118c470fa3811ed9add1fef7e5ef70f/snapshots/automation ./parent/configuration_data-6be54fa0fa3e11ed9add1fef7e5ef70f/snapshots/...
Saravanan's user avatar
0 votes
0 answers
16 views

Any options to prevent a rename command to move files from subdirectories to the parent directory after renaming?

I have following subdirectories in the parent directory ./ find . -type d|sort . ./M1_DMSO_120h ./M1_DMSO_24h ./M1_GW4869_120h ./M1_GW4869_24h ./M2_DMSO_120h ./M2_DMSO_24h ./M2_GW4869_120h ./...
akh22's user avatar
  • 115
0 votes
0 answers
40 views

Copy new files (or their hard links) to new location with other folder structure and with new name

I hope someone can advise me on a very tedious, repeating task. My university uses Moodle as its eLearning and file exchanging platform. So every now and then our tutors upload new files, that I have ...
lumanet's user avatar
0 votes
1 answer
103 views

shell one-liners for bulk-renaming multiple files

I am looking for two renaming one-liners to manage my music library. First concerns filenames. I would like to use as simple as possible names, that is : %track %title.ext for instance 01 Song name....
sylvainsab's user avatar
0 votes
1 answer
323 views

Rename file in Mac OS Terminal using Regex or translate from Windows Script

I would like help with a shell script for macOS to rename files with a certain pattern. The script would handle only one file, not multiple. Here are three examples: a. Public Talks_ (189) Walking ...
Allex Valentin's user avatar
2 votes
1 answer
57 views

How to rename files to specific string in their filenames

I have large amount of .json files that need to be renamed to a specific string of numbers in each file's name. They follow the format: [Artist] Title (Date) [Language][Publisher][Website.####][Pages]....
fukaeri's user avatar
  • 23
0 votes
2 answers
59 views

rename - move [ ] delimited part of filename to end of filename

I've been playing with the perl implementation of the rename tool in cygwin having finally got it working via installing from cpan. It's been a long time since i played with this stuff so I'm a bit ...
Adam B's user avatar
  • 3
0 votes
3 answers
105 views

How to interactively edit a file name from the terminal like with a file manager?

At the command line, one can rename a file by specifying the entire new name to mv mv oldname newname or using a regex with e.g. Perl's file-rename command. rename -d 's/old/new/' oldname But is it ...
Nahoj's user avatar
  • 119
0 votes
2 answers
95 views

rename files's name in linux

I need to rename 3028 files' names at once. Do you have any help? 0001____z1.0.tif --> 0001.tif 0002____z2.0.tif --> 0002.tif . . . 3028____z3028.0.tif --> 3028.tif Can i ...
Yeon Jin Kim's user avatar
0 votes
1 answer
79 views

Need help with a script that mv (renames) filenames that require single quotes in ls output or file operations

I need help with a script that mv (renames) filenames that are shown with single quotes in ls output or files that require single quotes for file operations. The script will be used to rename all ...
Psilospiral's user avatar
-3 votes
2 answers
46 views

Bulk Rename of Folders with Numbers

I need to bulk rename files called plt????? to plt??????. They're in numerical order from 0 to 99500 every 500, however I have some over 100,000 so I'd like them all to be in 6 figures. Aim: current - ...
Gilly Russell's user avatar
1 vote
3 answers
128 views

How to rename large number of randomly named file at one go?

In a directory I have large number of randomly named '.wav' files. For example 090913yui.wav jiyafa123.wav . . . awe-6rt.wav I want to change the file names to file1.wav file2.wav . . and so on Can ...
Turing101's user avatar
  • 153
-1 votes
1 answer
237 views

How to rename files in Linux like the ren command in Windows

I need to rename a bunch of files (more than 100) on an Ubuntu system, and want to know how to I do that when the pattern of the files is something like "Filename_01.jpg" to "...
Tornado726's user avatar
0 votes
2 answers
54 views

renaming files based on matched pattern in another file

I have a list of files: out_CCGCGGTT+CTAGCGCT_R1.fq.gz out_TTATAACC+TCGATATC_R2.fq.gz out_GGACTTGG+CGTCTGCG_R1.fq.gz out_AAGTCCAA+TACTCATA_R2.fq.gz ... the adaptor IDs (between the two underscores, ...
Anna1364's user avatar
  • 1,036
0 votes
1 answer
112 views

How to use sed on symbolic linked files?

I have some symbolic linked files and some normal files like below: P_2_UC34_31_1.gz P_2_UC34_31_2.gz P_2_UC34_32_1.gz P_2_UC34_32_2.gz P_2_UC34_33_1.gz P_2_UC34_33_2.gz P_2_UC34_31_1.gz and ...
beginner's user avatar
  • 277
1 vote
2 answers
56 views

Move and rename multiple subdirectories to new location

My directories are setup in this way: dir 1 001 11-20-2001-RT SIMULATION-57976 002 11-20-2001-RT SIMULATION-30560 003 08-24-1998-RT SIMULATION-72882 and so on for about 250 entries. My goal is ...
goldenburrito's user avatar
0 votes
0 answers
27 views

how to rename last part of multiple file in linux [duplicate]

I want to rename to files from below format to below format . How can i rename last part ? cheatsheetold1.gz.aux cheatsheetold2.gz.log cheatsheetold3.gz.out cheatsheetold4.gz.pdf cheatsheetold5.gz....
Anu's user avatar
  • 1
0 votes
1 answer
125 views

Renaming batch files for PLEX

I am attempting to rename a batch of .mkv files from the original format to the preferred PLEX format. I am having difficulty with sed and with rename and with mv. I hope it is just a syntax error I ...
kwayne's user avatar
  • 1
0 votes
1 answer
116 views

Rename directory hierarchy

How can I rename directory hierarchy? For example I want to rename c/d to x/y There won't be necessary only 2 folders. So the full directory path /a/b/c/d/e becomes /a/b/x/y/e after the operation. Not ...
ka3ak's user avatar
  • 1,265
4 votes
3 answers
1k views

Renaming files in Linux using perl scripting

I have a set of files with prefix, say "pre_", on a Linux machine and I just want to rename all of these files by removing that. Here is the perl code I wrote it doesn't throw any errors, ...
Sasi Pavan's user avatar
0 votes
2 answers
74 views

The loop for file renaming doesn't work right

There are 32 *.dds files in a folder: pic-0.dds, pic-1.dds, pic-2.dds,...,pic-31.dds I'd like to rename them to be: 015040.dds, 015041.dds, 015042.dds,...,0150471.dds. I'm trying to use the ...
misha.physics's user avatar
1 vote
0 answers
17 views

Undoable rename [duplicate]

I have a large number of files (specifically, my music collection) that I plan to rename (using Ex Falso). I have the files backed up, so in principle I can restore if necessary, but that would be ...
mikado's user avatar
  • 129
0 votes
3 answers
60 views

Rename multiple folders using external string manipulation tool

I am using ccase. The following command works. $ mv camelCase (ccase -t Kebab camelCase) Now I am trying to rename multiple directories using: $ find . -type d -execdir rename 's/(.*)/$(ccase -t ...
Ahmad Ismail's user avatar
  • 2,738
-2 votes
1 answer
175 views

Need to batch rename files with names from text file using core utils

So I am a bit of a noob and have a problem at work. There is a program outputs names in a ie apple banana orange P1n34ppl3 The problem is that the files that correspond to that (separate program) are ...
Hulknosmash's user avatar
0 votes
2 answers
179 views

Removing certain numbers from batch of filenames

I have a batch of files that contain the numbers 21 to 29 in the middle of the file name. As I do not want to remove that number for hundreds of files by hand I tried using Terminal: for f in *; do ...
Michael's user avatar
5 votes
1 answer
217 views

Is there a *BSD equivalent of MacOS renameatx_np, atomic swap file renaming?

I am looking to create a *BSD compatible C function like the one below: int fs_ext__swap (const char *from, const char *to) { int res = renameatx_np(AT_FDCWD, from, AT_FDCWD, to, RENAME_SWAP); ...
Lee's user avatar
  • 519
0 votes
1 answer
77 views

How to find the text between the nth occurence of a character and occurence n+1 with perl-rename?

perl-rename 1.14-1 Arch Linux: linux 6.2.12.arch1-1 I have a directory/folder with several subdirectories, all are named by one of the following patterns Status quo of existing patterns something-...
henry's user avatar
  • 914
4 votes
5 answers
725 views

Bulk rename directories with spaces

I have a bunch of files and directories containing white spaces (several of them in each file name) and I'm trying to remove them. I am plagged with the 'dumb' rename that does not understand regex. ...
MBR's user avatar
  • 964
3 votes
2 answers
634 views

How to rename all files of the same name to another name in all subdirectories

I have a bunch of subdirectories with nested directories that have files with the name output.txt . I would like to rename all those files to output_modified.txt I tried find . -type f -name "...
Ddavid's user avatar
  • 31
3 votes
3 answers
1k views

Changing numbers in name of the file using terminal

I have a large number of files with names file00.txt, file01.txt etc in a folder. Is it possible to rename all where the numbers will change to (4000+200*number) in terminal? I want the name of the ...
Ganapati Dash's user avatar
0 votes
1 answer
105 views

gvsf (GNOME virtual file system) on usb-ios, when I git clone, I get: fatal: could not set 'core.filemode' to 'false' , due to OS service to rename

I usb-connect my ios device on my linux laptop. The linux system mounts a gvfs point to it (/run/user/1000/gvfs/afc:host=xxxxxxxxxx,port=3), I change directory there, I can rsync back and forth, but I ...
Bruno Schroeder's user avatar

1
2 3 4 5
25