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
1answer
55 views

rename filenames based on some calculations

I have some files like this: file.i001.trusted.txt file.i002.trusted.txt ... ... file.i212.trusted.txt etc.. Now I want to change index numbers from i001 to i030 to A101 to A130 and i031 to i060 as ...
4
votes
4answers
586 views

Rename multiple files, removing all but one instance of a pattern

There has to be a simple solution for my problem, but I can't get it. I have multiple files in multiple folders, whose names have a pattern repeated multiple times in a row, like this: ...
0
votes
2answers
51 views

Change one part of the name of more than 1000 files

I have a set of about more than 1000 files that their names are such as IR.ANJ.G1.E.20060102.185428.mseed with G1 in common. I am going to change G1 in all files to SH. For example, IR.ANJ.G1.E....
2
votes
2answers
366 views

renaming files by adding the month and year defined in the file's timestamps

I have script below saved in MYFILES dir to create x number of files & their timestamps was randomly run with multiple years & months. for i in {1938..2037}; do ## create a file with a ...
0
votes
3answers
140 views

Add a folder in a sequence of folders and rename the other folders

I have x number of folders folder1 folder2 folder3 ...... folder100 What I want to do is; add folder2 reorder So now: folder1 folder2 folder3 ...... folder101 So now, the folder that was folder2 ...
0
votes
2answers
136 views

shell expanding rename command backreferences

When I'm using group matched pattern in rename command and use their back references in replacement part and I also want to have command substitution expansion as well within my rename command and ...
1
vote
1answer
216 views

How to manipulate multiple file names using find?

How to improve the command below to change a string in a filename. find . -type f -name '*<today>*' -exec mv {} {}_renamed \; Actually I have a few files in my directory with today's date as a ...
2
votes
1answer
2k views

(Bash) Renaming Files Extension

I am having problems trying to create a script to rename all of the files in my directory to .txt on Linux. This is what I have so far. #!/bin/bash location_number=$(find /hw1/textarchive | wc -l) ...
8
votes
6answers
4k views

rename all files in a directory to the md5 hash of their filename (not content)

I'm very new to linux / command line and need to encrypt the names of 10K+ files (unique names) so they match the MD5 encrypted name in the mySQL database. I've seen how you can rename a directory of ...
0
votes
2answers
754 views

Remove extension of files inside a list

I have a list "file.list" which contains .bed files . I want to remove the extension .bed from the "file.list" file I tried sed -i 's/.bed//g' file.list but that doesnt work .
11
votes
3answers
2k views

Who renamed a directory?

I couldn't find the answer to this anywhere. How can I know who renamed a directory? ls -al shows only the name of user who created that dirctory.
0
votes
1answer
143 views

How do I combine wget, sort and save into a new filename?

I am trying to combine several commands. First I use: wget xyz.com/zxc.txt Then I unscramble the file using: sort -n zxc.txt Lastly, I save the unscrambled file as a new file: sort -n zxc.txt > ...
2
votes
1answer
366 views

Perl rename hangs when renaming files with regular expression [closed]

I'm trying to use perl-rename on Arch Linux to rename many files according to a regex. I have a large amount of files in a folder that follow this format: Title of File [Year] - quality.filetype ...
0
votes
2answers
219 views

Removing extension of multiple file without using loop in linux [closed]

Sample files: RBFATL001USCGA002.--K1234-- RCAVTL001USCGA043.--K2135-- Output: RBFATL001USCGA002 RCAVTL001USCGA043
1
vote
3answers
190 views

Renaming files with spaces while keeping numbers intact

I'm looking to rename a lot of files that contain spaces in the file name while keeping the string of numbers intact. The numbers are not sequential and the string before and after the numbers are not ...
1
vote
2answers
232 views

Adding a suffix to many files while preserving the extensions

I have a directory ~/mydir/ with many files. Some of these files are ~/mydir/foo.py ~/mydir/foo.tex ~/mydir/foo.pdf ~/mydir/foo.log I'd like to change any file in ~/mydir/ whose base name is foo to ...
2
votes
4answers
2k views

How to rename multiple files by adding a common string at beginning of the files?

I have 100 files. I want to add a text 'new' before all the filenames. Please help me. Thanks in advance. Example: file1.txt ---> new_file1.txt . . . . file100.txt ---> new_file100.txt Please ...
0
votes
2answers
605 views

Replacing all colons with dashes in a set of files?

I tried to replace all colons with dashes in filenames from files in some subfolders using the following command: find . -type f -name "*:*" -exec rename -n 's/:/-/g' {} + However I get an error ...
0
votes
1answer
180 views

Rename Files Bash Script - Loop Problem

I am trying to write a script which will take my file and rename pt-1 to pt2 for eg. testfile_pt-1_date.ts at the moment the script will correctly rename to file and copy it to the specified folder ...
0
votes
1answer
703 views

bash alias rename function with arguments

I have been trying all day with no success to get bash to receive arguments: the closest reference to this I could find is: How to pass parameters to an alias? if i execute: rename -v -n 's/^the.//...
1
vote
1answer
98 views

Truncate if necessary when moving file to filesystem with shorter NAME_MAX

I want to move veryverylongfilename.txt to a filesystem which has a short NAME_MAX. mv veryverylongfilename.txt /mnt/tiny gives me an ENAMETOOLONG-type error: mv: cannot stat '/mnt/tiny/...
-3
votes
1answer
682 views

File renaming using bash script [duplicate]

Parent path is /opt/data/ and within data folder there are multiple subfolders and within those subfolders there are multiple files which I want to rename only some part of it using bash. Original ...
0
votes
2answers
57 views

How to rename multiple files by replacing string in file name?

I have basically splitted one file into 8 files. DA_TRP_TOTAL-SHIPPED_v1_DNH_2_2_20170502094536.dat #Original File I got 8 new files as below filename. DA_TRP_TOTAL-...
0
votes
2answers
620 views

rename middle name of multiple files using bash

I've multiple files located in /opt/rec/ which I want to rename only some part of it using bash. Original file name: WK6LZTPR99999999_dig_2017-07-10 01:55:57.xy which I want to change all files ...
1
vote
2answers
791 views

Batch renaming TV Series

My iTunes library is on a NAS (WD MyCloud 4TB), and I have a number of TV series, organised by iTunes library in the usual: 'TV Shows' folder: TV Show 1 |------------- Series 1 |-----...
1
vote
2answers
574 views

How to remove failed file with backspace in its name? [duplicate]

Sorry if I am not using the right terms for naming these "backspace chars". I would like to clean up a directory that contains two files which looks like they contain backspace in their name. If I ...
0
votes
5answers
815 views

Remove a specific suffix from all the files in a directory

I have a genotype file which I have split it into more than 2000 5K SNPs files by using split -d geno_file the output that I get is something like this: table_subset_0001 table_subset_0002 ...
8
votes
5answers
505 views

Alphabetize words within filenames using sort?

When reading tutorials on batch-renaming files in bash and using the sort command to sort file contents, I have not been able to figure out how to combine the two. I have a directory whose contents ...
1
vote
2answers
115 views

MV Sub-Directories up one level but not to root

I have several folders in the following structure that I would like to sort. For example: /root/sub1/aaaa/bbbb/cccc/dddd /root/sub2/aaaa/bbbb/cccc/dddd /root/sub3/aaaa/bbbb/cccc/dddd /root/sub4/aaaa/...
0
votes
2answers
76 views

Change File name by it's 2nd line content

I have a Config.cfg file and I want to rename it by putting the value of 2nd line in the name of the file. Example: $ more Config.cfg ! ! Configuration last changed by user '%LICM%' at Tue ...
0
votes
2answers
1k views

How to batch-rename files using bash script?

I have multiple files in one directory with below format, so I want to rename all like below: From 27_07_2017file1vc001vpxd-1605.log 27_07_2017case2vc001vpxd-9169.log 27_07_2017server3vc001vpxd-4640....
2
votes
1answer
3k views

How do you change your username in Manjaro?

How do you change your username in Manjaro Linux?
5
votes
2answers
11k views

Unzip archive with single file and rename output to match archive name

The goal is to unzip many zip files and rename the resulting file to the original archive name. Given a folder with many zip files, most of them containing a file called bla.txt, but of course there ...
1
vote
0answers
52 views

Missing Pathway [closed]

the task given for me is to write a script in linux to automatically loops the input files. I have given 400 files in a folder and each files have the contigs with header. So now, I need to rename the ...
1
vote
3answers
2k views

Shell Script to rename current working directory with given name

If present directory is DIR/ and new name project1/ is passed through argument, the present directory name should be replaced by project1.
0
votes
3answers
129 views

moving string from filenames with sed or rename them with rename

I have a bunch of video-files in one folder , that has a double suffix avi.avi. find /home/alex/Filme/ -type f -name '*.avi.avi' /home/alex/Filme/Super 8.avi.avi /home/alex/Filme/Exit - A Night ...
1
vote
0answers
325 views

Adding a postfix when downloading files using CURL if a file by that name already exists

I'm downloading files from a POST endpoint using a command on the form while true; do curl -O -J http://domain/endpoint; done This endpoint "returns" a new file on each POST call. Curl gives each ...
2
votes
2answers
426 views

Looking for a script to convert a filename with backslashes into a directory structure with files

We are currently testing a new application on Linux that previously worked on Windows. It appears there were some hard coded paths in the program and a bunch of test files with long filenames with ...
5
votes
2answers
3k views

Find and replace string in directory names

I have a file structure that I had to recover and it contains :2f in the name For example directory name anyname:2fmorename I want to be able to change :2f to _ in all directories and sub ...
0
votes
1answer
494 views

How to rename multiple filenames using find/rename

I have on a Samba server lots of files in directories/subdirectories containing special chars. The problem is that, the files (containing a special chars) are not visible when I try to view files ...
0
votes
1answer
176 views

how to batch rename files in terminal - move text in file name from end of file name to front

I have recently started using wget to download files. I'm using ubuntu 16 mate to manipulate my files. I create custom urls to include specific information that I want saved to the downloaded file ...
0
votes
2answers
679 views

How do I add the current date before the file extension for multiple files in a directory?

How do I add the current date before the file extension for multiple files in a directory? Original files: Expenses.log Allowances.log Output: Expenses_20170624.log Allowances_20170624.log This ...
1
vote
5answers
79 views

How to drop some string in every filename

[root@localhost ~]# ls *.bak test2.bak test3.bak test9.bak test.bak test.txt.bak How to drop all .bak in all file?This is my current try ls *.bak|xargs -t -i mv {}.bak {} But it don't work ...
0
votes
2answers
485 views

How to delete one character/letter from file name

I am looking to change a batch of filenames to remove a letter, like so: Stain-A_1P.fastq to Strain-A_1.fastq Strain-A_2P.fastq to Strain-A_2.fastq I have tried the following: rename 's/P//' *...
2
votes
2answers
2k views

mv: add number to file name if the target exists

I'm moving a file to a different folder and would like to add some kind of index to the newly moved file if a file with the same name exists already (the old one should remain untouched). Here I've ...
0
votes
1answer
46 views

Growisofs renaming files

I was trying to copy several files to a dvd with growisofs. The command I use it is: growisofs -Z /dev/dvd -R -J /media/34GB/tmp/ But when I send it to command line, I receive this message I: -...
2
votes
2answers
154 views

Can Xubuntu's file renamer be used without XFCE?

In Xubuntu you can select multiple files, right-click, click rename, and it will open a really useful interface for mass renaming files. Can this be installed and used on other desktops like Gnome/...
1
vote
2answers
5k views

Add text to end of the filename but before extension

I have several mp3's that i need to add '_p192' before the extension. I've tried this : for f in *.mp3; do printf '%s\n' "${f%.mp3}_p192.mp3"; done following this post: adding text to filename ...
1
vote
1answer
596 views

How to rename multiple files with a prefix and suffix using a find command

I have the following command which renames a number of files found by the find command by adding the suffix "processed". How would I modify this to also add a prefix like "ren" ? find . -type f -...
2
votes
1answer
82 views

Renaming and rearranging multiple filenames without rename

I have almost 500 directories full of files with names like e141107140847.pdf, and I need to rename them to something user-friendly like 2014_11_SDUXS_0847.pdf. I've been trying to use a for loop and ...