Skip to main content

All Questions

0 votes
1 answer
396 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....
nayeim77's user avatar
0 votes
1 answer
809 views

How to use a Bash Script to move and rename files with grep

Hi I an FTP folder called Input where I get sent files which look something like this: "Guide to Iceland _ Chen-ping Wang itinerary T-987654987.pdf" "Guide to Iceland _ T-123654875 Chen-ping Wang ...
Þorgeir Valur Ellertsson's user avatar
3 votes
5 answers
6k 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 looking ...
Edward Alekos's user avatar
1 vote
4 answers
225 views

Use wildcard output as a variable in an arithmetic computation

I have files with names and directory paths as follows: t10n2/data/file.dat0, t10n2/data/file.dat1, t10n2/data/file.dat2, ... I wish to change the names of the files using an arithmetic operation ...
ap21's user avatar
  • 133
2 votes
2 answers
912 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 ...
trixie101's user avatar
  • 145
3 votes
4 answers
10k 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 ...
Dipankar Nalui's user avatar
-1 votes
1 answer
968 views

Shell script to move files and rename it with index [closed]

Consider two directories A and B. A contains a text file A.txt which changes its contents every 3 seconds. The shell script is to move A.txt to directory B and rename it to A_1.txt. After 3 seconds ...
iTamizhan's user avatar
2 votes
1 answer
885 views

Adding folder name to .zip files inside it

I have file1.zip, file2.zip, etc. in folder called folder1. have similar folders folder2, folder3, etc. I need to add folder name to each .zip file inside these folders. So, files inside folder1 ...
Krishna's user avatar
  • 29
1 vote
2 answers
1k views

Using rename to remove '.orig' from file and add '_1' to basename

I'm using a script to make backups of files, and to avoid overwriting files I've used cp --backup. Which leaves me with a number of files that look like example.mov.orig and test.mov.orig. I cannot ...
Richard Good's user avatar
2 votes
3 answers
2k views

Copy filenames, and add path prefix, in a directory, recursively

I have a working directory: /home/myusername/projectdir The working directory contains files and sub-directories. The depth of sub-directories is not known. I want to put all the *.log files into the ...
BlackCat's user avatar
  • 405
19 votes
9 answers
75k views

How to rename all files with special characters and spaces in a directory?

How can I rename all the files in a specific directory where the files contains blanks spaces and special characters ($ and @) in their names? I tried the rename command as follows to replace all the ...
Ankit Vashistha's user avatar
66 votes
3 answers
246k views

How to rename multiple files in single command or script in Unix? [duplicate]

I have the below list of files aro_tty-mIF-45875564pmo_opt aro_tty-mIF-45875664pmo_opt aro_tty-mIF-45875964pmo_opt aro_tty-mIF-45875514pmo_opt aro_tty-mIF-45875524pmo_opt that I need to rename to ...
Udhayakumar's user avatar
1 vote
2 answers
722 views

renaming a directory and its subdirs without affecting their files

I have to rename directories under the root directory with prefix "ms_PF" and then rename their subdirectories with the modified name of the main directory with an extra "_", and then copy all ...
terry's user avatar
  • 11