The tag has no wiki summary.

learn more… | top users | synonyms

3
votes
2answers
31 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
266 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
22 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
36 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
66 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
71 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
35 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
88 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
76 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
101 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
166 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
272 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
443 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
27 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
66 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
46 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
227 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
129 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
66 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
306 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
84 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
94 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
197 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
311 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
63 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 ...
23
votes
5answers
2k views

Quickest way to rename files, without retyping directory path.

I know how renaming files in Linux : $ 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
111 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
316 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
78 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 ...
6
votes
5answers
1k 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
100 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.
4
votes
2answers
275 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
626 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
167 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
145 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
140 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
49 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
129 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
119 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
114 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
0
votes
4answers
2k 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 ...
1
vote
1answer
40 views

Rotating a file

I have an application which write to a file. Before I run the application, I would like to rotate the file. In others move file.n to file.n+1 file to file.1. I can write a script to do this, but I ...
1
vote
2answers
600 views

cp and mv if the file named already exists

What happens when you give the following commands if the file named done already exists? $ cp to_do done $ mv to_do done
1
vote
2answers
112 views

moving files of certain formats from subdirectoris to directories with same folder names

I’ve got a weird situation. I have 100s of folders with flac and mp3 copies of the same tracks. I need to separate the mp3s from the flacs and put them into similarly named directories. for example: ...
2
votes
0answers
54 views

Batch mv cronjob leaving some (not all) copies in source

I have a cronjob that runs every 5 minutes, looking for wavs and mp3s of the same name in a source directory and if it finds a corresponding pair, it moves both to a destination directory. The script ...
1
vote
1answer
64 views

How do I rename lots of files on a directory without changing their extensions? [duplicate]

I have a problem! I have a bunch of image files with extensions. Jpg and. Png. I wrote a script that renames the files, changing their names in a pattern followed by a number like this: ... ...
12
votes
6answers
837 views

Subtract 1 from all file names (rename them) in a directory.

I have a directory which contains image files with names like image1.jpg image2.jpg image3.jpg ... Unfortunately, the image names must be zero based, so image1.jpg should be image0.jpg, ...
-1
votes
4answers
289 views

command to mass rename files according to pattern [closed]

I have a lot of files in a directory that are named as follows ID_OTHER_STUFF.txt I'd like to rename them all to ID.txt. This isn't a duplicate because I don't know how to specify this pattern.
3
votes
2answers
227 views

Moving large numbers of files and directories to a different directory

I'm trying to move the following move a large number of files that exist in the following structure to a /mnt/originals but I need to maintain the structure at the same time. I know cp would be a ...