Tagged Questions

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.

learn more… | top users | synonyms

0
votes
2answers
26 views

Rename multiple files [duplicate]

Preface: I am an absolute novice with Linux, please don't judge strictly. I have a directory containing several images (over 100) of a .pnm extension. I wish to rename them in such a sense, that ...
1
vote
1answer
47 views

Replace new lines char (^M) in all files and then rename file based on char string

I am not a UNIX guy but understand enough to gin up small scripts here and there except for this one where I may personally be not able to devote enough time. I have about 2000 files in a directory ...
4
votes
2answers
52 views

How to exchange words in a filename using the shell?

One of my customers is a school. On their file server all projects have a directory with the same naming scheme. <last name>, <first name> <second name>? - <project ...
0
votes
4answers
48 views

Bash multiple rename in one line: is possible?

Is possible to rename and substitute on fly with bash? for example i have VTS_01_1.VOB VTS_01_2.VOB VTS_01_3.VOB I want to rename for use in mencoder with movie_1.avi movie_2.avi,etc.. I ...
0
votes
0answers
21 views

Is it possible to name a QThread? [migrated]

I have a Linux Qt application that creates some QThreads. I know that when you create a thread it inherits the parent name and I can see it when I use htop or ps ax -L. Is it possible to name those ...
1
vote
3answers
51 views

How to rename multiple files by inserting numbers

I have a list of files like the following: pairs10_10.mp3 pairs10_11.mp3 pairs10_12.mp3 pairs10_13.mp3 pairs10_14.mp3 pairs10_15.mp3 pairs10_16.mp3 pairs10_17.mp3 pairs10_18.mp3 pairs10_19.mp3 ...
0
votes
2answers
108 views

scp with password and renaming the file [closed]

I need to execute scp command with renaming the file. I have tried with following code: HOST=lnx25 USERNAME=ngqa PASSWORD=xxxxx FILE=$1 FILE_NAME=`echo $FILE | awk 'BEGIN{FS="/"} {print $NF;}'` ...
1
vote
5answers
67 views

Rename a portion of multiple files

Take a number of files named: data_a_LT.fits data_a_LT.coo data_a_LT.ec data_a_LT.grp I want to replace all "a_LT" with "LT_A" such that I have: data_LT_A.fits data_LT_A.coo data_LT_A.ec ...
3
votes
2answers
80 views

zmv command to rename file after matching pattern

I was trying to figure out a solution for this question using zmv. I am unable to find an exact solution using zmv. This is what I could come up with so far. From here, I could rename all files like ...
5
votes
4answers
289 views

How to rename to fixed length

I have files named as 0-n.jpg for n from 1 to 500, for example. The problem is that some guy using Windows didn't use leading zeros so when I do ls I obtain 0-100.jpg 0-101.jpg ... 0-10.jpg ... ...
0
votes
1answer
27 views

How to remove a specific string from file name [duplicate]

I have a report running in UNIX and creating a file named xxxx_ddmmyy_hhmm_zzzzzz.txt. I need to remove the zzzzzz from the file name. How do I do it?
1
vote
3answers
53 views

rename hundreds of file by removing last few characters

I have hundreds of file andI want to remove last 7 characters from the filename but keeping its extension. Old name: abc_xyz12_4567.txt abcde_xyz12_4567.txt New name: abc_xyz.txt abcde_xyz.txt ...
4
votes
5answers
77 views

Rename Multiple files in unix

I have multiple files whose names look like this 2313_ABCDEAUG2014_PQRST_0_.pdf 3244_ABCDEAUG2014_PQRST_0_.pdf 4234_ABCDEAUG2014_PQRST_0_.pdf t want to rename the file in the following format. ...
1
vote
3answers
93 views

rename files with rename command

Please advice what is wrong with the following command find /tmp/dir -name "* *" -type f | rename 's/*/fixed_/g' remark - I prefer to do that with one command not loop syntax What I want is to ...
0
votes
3answers
42 views

rename a list of files according to a text file

I have a list of files in a folder, which I will like to rename according to a textfile. For example: These are the 5 files in the folder. 101_T1.nii 107_T1.nii 109_T1.nii 118_T1.nii 120_T1.nii I ...
2
votes
2answers
113 views

find file, copy but with different name

I have files with random numbers in /home/user/files folder (every 4 days I have new ones). for example: john20 john25 john40 tom12 tom32 simon2 simon8 simon53 I want to take only last modified ...
0
votes
2answers
84 views

change the extension of all files based on user input

I was taking an online assessment and I got the below question. Create a script located at /usr/local/bin/set-file-extensions that will change the extension of all files in the directory ...
1
vote
2answers
116 views

Rename a file dynamically containing spaces [duplicate]

I want to rename a file dynamically based on data which contains spaces Name="Abc DEF" Name1="GHI JKL" mv /sample/pdf/noriginalName.pdf /sample/outputPdf/${NAME}${Name1}".pdf" But it gives me an ...
0
votes
5answers
408 views

Move files to multiple folders [closed]

I've searched for this function, and there are lots of answers, but I haven't been able to find anything that works for me. I have a folder with about 30,000 files, and I want a terminal command or ...
4
votes
1answer
343 views

replace all dots in filenames with underscore

I have a directory with some subdirectories with filenames and directorynames that contain some dots: $ ls -R .: dir file.with.dots ./dir: subdir.with.dots ./dir/subdir.with.dots: other.file I ...
21
votes
3answers
2k views

How to rename file to .. (dot dot)?

Apparently you can rename file to .... If I were insane, how would I rename file to .. or .? Is such a filename even allowed? Backslash doesn't seem to disable dot's special meaning: $ mv test \. ...
6
votes
4answers
782 views

Delete spaces, hyphens, and underscores in filenames?

What is a good command to delete spaces, hyphens, and underscores from all files in a directory, or selected files? I use the following command with Thunar Custom Actions to slugify filenames: for ...
1
vote
1answer
34 views

Two HDD partitions with the same name result in uncertain directories

I'm running Ubuntu 14.04 on a machine that has a lot of hard drives plugged into it. These hard drives have partitions with old OS's which have a lot of key data that I use often. The problem is, I ...
4
votes
4answers
91 views

Renaming multiple files with rename

I need help renaming files in batch--the other questions I browsed don't exactly address my problem. The names of my files are generated non-deterministically, so I can't predict what they will be ...
1
vote
2answers
91 views

rename a batch of files after reading from a source file

I have a directory full of over a thousand files and the names are bit long (and no pattern found in the naming style). I would like to simplify the filenames. E.g.: ...
5
votes
3answers
341 views

How to remove dot and space from beginning of filenames

I'm trying to change jpg files named with a dot and a space at the beginning and with a missing dot before the end (like this . Startjpg to Start.jpg The dot makes the files hidden from sed and ls ...
1
vote
2answers
147 views

How would I change file permissions if the file name has a space in it in linux [duplicate]

I would like to know how would I rename and change file permissions of a file that contains a space in the name on Linux. Example The name of my file is: my file I have tried mv my%20file my_file ...
2
votes
1answer
74 views

Renaming the files and move to other path

I need to rename the files given below and move to some other path 1234551abcde20140718023216001.txt.809047512.2014_07_07_13:47:44 000001abcde20140718023216001.txt.34568.001.2014_07_07_13:50:44 ...
6
votes
2answers
551 views

Batch rename image files by age plus add date and variable to filename

The question is completely rewritten due to things learned from the first two answers and comments that I was unaware of when first asking. After a photo shoot I come home with files that look like ...
3
votes
3answers
132 views

How can I use rename to recursively rename everyting to uppercase

I'd like to recursively rename all files and folders (sub-folders) to uppercase. I found some scripts that will do it to lowercase, but I don't know how to change them so it will do it the other way ...
2
votes
1answer
126 views

Create directory using filenames and move the files to its repective folder

I have a folder with around 150 text files. I would like to create folders in the name of the 150 files. After that I would like the text file to be moved to its respective folder. Example names of ...
3
votes
1answer
328 views

Rename files with spaces in a BusyBox shell

I'm trying to rename some files on my Synology Diskstation via SSH. The available shell is the BusyBox built-in shell: BusyBox v1.16.1 (2013-04-16 20:13:10 CST) built-in shell (ash) The move ...
6
votes
5answers
351 views

Renaming files with its path name

I have a .bdf file inside subfolders. All the .bdf have the same name: Loads.bdf Example: /home/user/folderxx/folderxxx/Load.bdf /home/user/folderxx/folderxxx/Load.bdf I need to find (and copy to ...
3
votes
3answers
68 views

Moving an open file to a different device

I have an application running that is generating a large (~200GB) output file, and takes about 35 hours to run (currently I'm about 12 hours in). The application just opens the file once then keeps it ...
27
votes
5answers
2k views

Quickest way to rename files, without retyping directory path

I know how to rename files in Unix: $ mv ~/folder/subfolder/file.txt ~/folder/subfolder/file.sh ^------this part-------^ ^------this part-------^ I think it takes too long time to repeat ...
2
votes
2answers
178 views

Find and rename files adding part of the path to filename

I have a folder with two level of subfolders inside it. Inside the second subfolder, there is a jpg file. All the jpg have the same name: cover.jpg Example: /home/user/folder001/folderAAA/cover.jpg ...
1
vote
4answers
495 views

renaming multiple files increment order

I have the following files SSt12.precip.374.sub.climatology.ctl SSt12.precip.2874.sub.climatology.ctl SSt12.precip.3764.sub.climatology.ctl SSt12.precip.6774.sub.climatology.ctl I want to rename ...
1
vote
2answers
81 views

Renaming a whole folder content

I'm on OSX 10.9.2 (BASH 3.5) and I wanted to rename a whole folder content names. So I run a script and somehow ended with this: s01eDavid.Letterman.2014.02.27.Stupid.Human.Tricks.x264-SWOLLED.mp4 ...
8
votes
5answers
3k views

Merging folders with mv?

If I move a folder with mv called "folder" to a directory that already contains "folder" will they merge or will it be replaced?
2
votes
1answer
111 views

Move extension-less files with mv

I have a folder with images(png, bmp, jpg) and extension-less files. I cant figure out how to move only the extension-less files. They are all random numbered files.
5
votes
2answers
446 views

SSHFS seems to be working, but Sublime + SSHFS doesn't?

I use the command, to mount my remote filesystem using SSHFS: $ sshfs -o uid=1000 -o gid=1000 root@10.0.1.198:/ "/home/chendy/my_mount" Everything seems to be happy, unless I try and open and save ...
14
votes
3answers
711 views

Move files and change ownership at the sametime

On Linux (Debian, Ubuntu Mint...), Is there any option command or something that I can use to transfer files to another user without having to do : sudo mv /home/poney/folderfulloffiles ...
4
votes
2answers
189 views

Faster way to rename duplicate files (identified by fdupes) in another directory?

I have a directory full of pdf files of journal articles, most of which are named by their bibtex key. Some time ago I made a backup on an external hard drive, but I haven't kept it up to date and ...
2
votes
3answers
239 views

Renaming file which got a quote mark ' in its name

I got a little bit of a problem. One client tasked me with the migration of sites from a really old server. Don't know how they got there, but there are files with ' in their names. Is there any way ...
0
votes
4answers
208 views

Mass mv on files and changing filenames [duplicate]

I want to change these filenames download (19).download ... download (27).download to download (19).html ... download (27).html I run unsuccessfully mv *.download *.html usage: mv [-f | -i | ...
0
votes
2answers
54 views

How to rename multiple files [duplicate]

I have files with names as, A2002185.h23v04.005.2007177004246.hdf A2002201.h23v04.005.2008288062542.hdf I want to rename them by deleting everything in the name after first dot (and have names as ...
2
votes
2answers
136 views

How to rename filename with ' or ? in file name?

I have a problem renaming a file that I'm not even sure which special characters I have in the file. I'm using CentOS 6 64bit. When I ls the file: Giko Suzo San?e - Ep1.avi but when view it in ...
2
votes
2answers
141 views

Shell Scripting: how to use part of the file path as the file name?

I have a group of directories, each containing exactly 1 jpeg image, like so- /psds/folder1/image.jpg /psds/someotherfolder/picture.jpg /psds/yetanotherfolder/thumbnail.jpg What is the appropriate ...
3
votes
3answers
125 views

Change the name of a file that contains spaces in the name

I don't know why but when I go to change this file name with mv command it comes up with the error stating not a directory. -bash-4.1# mv {{ THEME SANITIZED }}.hacks.css myomega.hacks.css
2
votes
4answers
5k views

Rename multiples files using Bash scripting

I want to rename multiple files in the same directory using Bash scripting. Names of the files are as follows: file2602201409853.p file0901201437404.p file0901201438761.p file1003201410069.p ...