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

Renaming hundreds of non-empty directories

OS is Centos 7 I've looked for a couple days now and feel like I should have found something for this by now. I have hundreds and hundreds of directories like the following: /tmp/user1/app/webapp/...
1
vote
2answers
30 views

remove asterisk from filename

I have a bunch of filenames that look like this: 2501254200*.nc I want to remove the asterisk. But when I use the following code: mmv '***' '#1#2' I get the error 2501254200*.nc -> : bad new ...
-1
votes
2answers
49 views

Renaming file from a script? [duplicate]

I am creating a script which would enable me do something in a shorter amount of time. Is there a way that I can rename a file automatically from: WDMyCloud_plexmediaserver_1.16.1.1291.bin(07082019)' ...
-2
votes
4answers
71 views

How to rename multiple folders at once to remove certain characters? [duplicate]

How can I rename all these folders at once to remove "-v4"? My directories look like this: drawable-hdpi-v4/ drawable-ldrtl-v4/ mipmap-mdpi-v4/
1
vote
0answers
9 views

Issue renaming multiple directories within the same path [duplicate]

I'm still new to bash but I have the following short script find "somedirectory" -name "* - *" -d -not -path '*/\.*' | while read a do mv "$a" "${a// - / }" done The objective being to replace ...
0
votes
1answer
33 views

to apply counters on directories inside a folder

I've a folder structure like this: drwxr-xr-x 2 root root 4096 Jun 30 21:34 dir_0.0.1_2 drwxr-xr-x 2 root root 4096 Jul 2 23:45 dir_0.0.1_1 -rw-r--r-- 1 root root 24 Jul 3 00:03 a.sh drwxr-xr-x 2 ...
0
votes
1answer
33 views

Renaming 100 files in a directory to new file names stored in a text file

I have a list of 100 files in my working directory for example GCF_000021605.1_ASM2160v1_genomic.fa GCF_001887455.1_ASM188745v1_genomic.fa GCF_003719755.1_ASM371975v1_genomic.fa GCF_000021625....
0
votes
1answer
39 views

Move files to specific folders based on name

I have this file/folder scheme: /Aula /Aula01 /Aula02 aula-01.1.mp4 aula-01.2.mp4 aula-01.3.mp4 aula-02.1.mp4 aula-02.2.mp4 aula-02.3.mp4 All the mp4 files are located in the root directory (...
1
vote
3answers
45 views

How to rename the multiple files within a directory

I want to rename the below files Var1DecoderBase.cpp Var1DecoderDerived.cpp Var1EncoderBase.cpp Var1EncoderDerived.cpp Var1Factory.cpp to Var4Config.cpp Var4CountDownTimer.cpp Var4DecoderBase.cpp ...
0
votes
1answer
31 views

Rename non alphabetical & numeric characters in files with nothing

I have a load of .jpg files in a folder that have non alphabetical characters like ! , ( ) ^ & . and more. I need to rename the files so that anything that is not A-Z a-z 0-9 is replaced with ...
0
votes
2answers
55 views

Sort and mv files based on filename (with spaces), recursively

I have made a mistake and dumped files together into the same directory. Luckily I can sort them based on the filename: ''' 2019-02-19 20.18.58.ndpi_2_2688_2240.jpg ''' Where the # bit or 2 in this ...
1
vote
3answers
46 views

Remove character pattern at beginning and end of filenames

I have a bunch of files that I'd like to rename. Their filenames are in a certain format: p1.uniquenameA#blah_a p2.uniquenameB#blah_b p3.uniquenameC#blah_c p4.uniquenameD#blah_d p5.uniquenameE#blah_e ...
0
votes
1answer
37 views

How to rename a bulk of files and remove extension

I am need to rename the below files. I only want to remove .job-209675 from the filenames that begin with SOA but keeping the original filenames intact as there are other files in this directory for ...
0
votes
2answers
51 views

how to detect files rename, without snapshot

I am currently monitoring directories with subdirectories, and I need to detect file rename. what I do is making a md5sum of all files and a keep a file list on another place, and from time to time ...
3
votes
2answers
107 views

Rename photos to match video titles

I have a mostly automated media server and currently have everything going into one folder and being sorted out by file extension into the correct locations. At the moment the photos are coming in ...
0
votes
5answers
87 views

Special “copy and rename” case

I have a deeply nested folder structure in which there are hundreds of files called data.log. I need a script to rename each of these data.log files according to the name of the parent folder they are ...
0
votes
2answers
49 views

Get filenames and write them on place of previous namespace

I have hundreds of sources codes files. I want to rename namespace according to the filenames path. Of course slashes must be replace by dots. I have tried with find -exec but I failed to get the ...
2
votes
1answer
235 views

How to modify this `while read; mv printf` code to rename only files of certain filetype?

Code in question: ls | cat -n | while read n f; do mv "$f" `printf "video_%03d.mp4" $n`; done The above code will rename all files/folders within the directory executed to: video_001.mp4 video_002....
12
votes
4answers
1k views

How to rename multiple files in a directory at the same time

I have directory say /var/tmp/abc which has 4 files: 12345-ram-3e3r5-io9490-89adu9.csv 45434-dam-qwe35-to9490-43adu9.csv 11234-cam-yy3r5-ro9490-85adu9.csv 14423-sam-hh3r5-uo9490-869du9.csv I want to ...
0
votes
0answers
24 views

Renaming multiple files in specific order

I am looking to rename the 137 .jpg files from a directory with numbers from 1 to 137 keep the same order. The files look like this: IMG_20190512_164221.jpg IMG_20190512_171322.jpg ...
1
vote
2answers
304 views

wget download files from a file list, how to specify names for each of the downloaded file?

When downloading a single file, we can use wget's -O option to specify the file name. When I'm downloading Urls in a file using wget -i filelist.txt (filelist.txt contains list Of Urls I want to ...
3
votes
1answer
54 views

Find files then move them and rename them at the same time?

Currently I use three steps to gzip some static assets and then use s3cmd to an S3 bucket (technically it's a Digital Ocean Spaces bucket). Here's what I do: $ find . -type f -name '*.css' | xargs -I{...
0
votes
1answer
49 views

Can't remove commas in filenames on Linux

I have folder named 'data' in the terminal folder. Some of the file names in data have a ',' in them. I am able to list them by $ cd data $ ls -i |grep -E '\,' But I don't know how to remove ',' ...
1
vote
1answer
32 views

how to rename a number of files using wildcard as prefix

Assume I have many files names something like: foo_192.168.1.1.sh bar_192.168.1.1.sh baz_192.168.1.1.sh qux_192.168.1.1.sh and I want to rename them all to foo_192.168.1.100.sh bar_192.168.1.100....
0
votes
1answer
60 views

How to rename a file with different name? [closed]

I have a file named servername_test_LINUX_test_test_2019-04-19.xls I have to create multiple copies of this file, with the condition that server name should be changed in each file created e.g. ...
0
votes
1answer
57 views

Does changing Linux username give any problems?

I've installed Linux Mint on my old laptop. I created a username with the temporary use in mind so it is not that good name and I want to change it. I know how to change username and rename the ...
1
vote
2answers
56 views

Want to rename a files in folder with folder_1.txt folder_2.txt folder_n.txt name

I have 3 directories on my Ubuntu machine, named abc, xyz and pst. In each directory, I have approximately 7 files with different names. I want to rename each file like abc_1.txt, abc_2.txt, abc_3.txt,...
0
votes
1answer
26 views

Copy and rename files to a sequential numbering with subdirectories

I want to copy files of the given type with inside subdirectories. I think copy of the zzz.txt file works after copying the files in the abc_folder. How can i resolve this problem. AAA ---aaa.txt ...
0
votes
1answer
26 views

Copy only files with certain extension while renaming each file according to the parent folder

I have several directories: ├── folder1.x │   ├── dsferwe │   ├── ewrwr342 │   ├── analysis │   ├── fdsds │   ├── vcxvcxz │   ├── 324322 │   ├── export.asc │   ├── f_random_subfolder.xf │   │   ├── -....
0
votes
3answers
62 views

In a bash shell script, how to rename multiple files, keeping only the numbers and the extension of the original file names?

I have a directory with a bunch of files with names like this: generic name- dd -01 _.txt generic name- dd -02 _.txt generic name- dd -03 _.txt generic name- dd -04 _.txt And I want to rename all of ...
0
votes
1answer
46 views

Swap words and reformat date in a filename

I have several recordings with a file-name schema like this %year%month%day-%hour%minute%second__%phonenumber.amr e.g.: 20190212-112007__+313206601234.amr I want to swap words to obtain: %...
0
votes
1answer
37 views

batch rename files in Ubuntu: sequential numbering, based on order in directory. (Ubuntu 16.04)

I had to download videos from DVR in more trials. After that files were manually arranged by alphabetical order into few groups, in each group by numbers. It is necessary to have videos in former ...
10
votes
4answers
2k views

What's the difference between 'rename' and 'mv'?

It's not completely clear to me, but what is the difference between mv and rename (from util-linux-ng 2.17.2 as /usr/bin/rename)? Are there advantages of one over the other beyond rename accepting ...
1
vote
1answer
29 views

How to rename all md type files under subfolders recursive?

$ tree . . ├── tmp1 │   └── acsfd.md ├── tmp2 │   └── adb.md └── tmp3 └── aa23aa.md ... └── tmpn └── random.md Want to rename all md files to index.md, I tried: find . -name "*.md" -exec ...
0
votes
2answers
65 views

Bash: minus one to the sub string split by separator

I would like to batch rename filenames turning A-B-C#2-D.wav to A-B-C#1-D.wav. So for example: A-B-C#2-D.wav A-B-C#8-G.wav A-B-C6-E.wav becomes A-B-C#1-D.wav A-B-C#7-G.wav A-B-C5-E.wav So the ...
-1
votes
1answer
25 views

Rename a directory and subdirectory inside a directory having same name

I have a directory called Dual_Loop_PLL. Inside that I have 2 subdirectories: agent and test. Inside agent I have a directory called dl_pll_agent, and inside dl_pll_agent I have dl_pll_agent2. I want ...
-2
votes
1answer
23 views

Move files from one directory to another. But, rename files before the move if the destination directory already contains file of same name? [closed]

I need to move all the text files from /abc/d1 to /abc/d2, but files need to be renamed if /abc/d2 has files with the same name already. cd /abc/d1 mv *txt /abc/d2
-2
votes
2answers
177 views

how to remove all characters after and including “?” in filename?

I have a large amount of files that were downloaded and ended up having what looks like authentication parameters added to the filename which I would like to remove. Examples: file1.doc?...
0
votes
1answer
30 views

How to fix this command mass renaming files to match a text file [closed]

for file in *; do read line; mv -v "${file}" "${line}"; done < /var/www/html/uploads/songs.txt It works as in changing all 700 files. But it doesn't seem to do it in the correct order. I feel ...
1
vote
2answers
47 views

How do I mass remove certain characters from directory/file names

What's a command I could use to do this on fedora 29 I need to remove [,], and -. If possible just remove the characters. Otherwise I'm good with replacing them as '_' I have 2,400+ files and ...
0
votes
4answers
229 views

How to shuffle file names randomly in a directory

Say i have a directory of filenames: file_010.ext file_011.ext ... file_99.ext What's the simplest way to take each file and randomly rename it to any other name in the directory, without there ...
-1
votes
2answers
51 views

How to batch rename files in folder [closed]

I have a zip file where each file is named the following original.jpg.1.png original.jpg.2.png The files are actually jpegs How do I go about renaming them to the following? original1.jpg original2....
1
vote
2answers
126 views

How to mass rename files with regular expressions [closed]

I have a bunch of folders in a directory with files in them. Most of the filenames have region codes (retropie), and the scrubber will not match roms with single letter region codes (u,j,e,etc.). I ...
0
votes
2answers
66 views

Rename files with zero padded numbers while keeping extension using “rename” command

I want to rename files with zero padded numbers while keeping extension. Example a.abc b.cde c.xyz to be renamed as 001.abc 002.cde 003.xyz :~/x$ rename -n -v 's/.+/our $i; sprintf("%03d.jpg", ...
0
votes
3answers
65 views

Move or rename subfolders

I have a folder structure like this: /ms/files/a/ /fb/files/a/ /db/files/a/ It should be like this: /ms/files/b/ /fb/files/b/ /db/files/b/ I can find the folders I need to move or rename using ...
1
vote
2answers
53 views

Finding a rogue script changing filenames?

I've got a server that is used as an SFTP endpoint and a script living somewhere else that periodically uploads to the server. At a particular time every day all the files in the upload folder get ...
0
votes
2answers
171 views

Use FIND with MV to rename files. Delete the found string then prepending it to the filename?

find . -type f -name '*authors-name-string*' -exec bash -c 'mv "$0" "${0/authors-name-string/}"' {} \; I am trying to rename files nested in several layers of directories that contain an author's ...
1
vote
1answer
144 views

Batch to rename episodes

im trying to create a bash to automate rename files from, if for an anime: Example: [TAG] One Piece - 01 [Quality].mkv to: [TAG] One Piece - S01E01 [Quality].mkv But this isnt always because i ...
1
vote
1answer
112 views

Terminal: rename multiple JPG files to HEIC format giving a condition

I have a folder where there are many pictures taken with my iPhone. Turns out that half of them are JPGs and half of them were supposed to be HEIC format. For some reason, all pictures in this folder ...
1
vote
1answer
111 views

How to rename files with sequential names to an another sequence using Terminal?

I have a directory that has files in it that are named 'o1.ray' to 'o293.ray'. I want to move them to an another directory while renaming them 'o132.ray' to 'o424.ray'. How can I do this in the ...