Sponsored Content
Full Discussion: Multiple file renaming
Top Forums UNIX for Dummies Questions & Answers Multiple file renaming Post 302244348 by ghostdog74 on Tuesday 7th of October 2008 07:33:19 PM
Old 10-07-2008
if you have Python, you can use the script here
example usage
Code:
# ls -1
IMAG0001.JPG
IMAG0002.JPG.ext2.ext2.ext2
IMAG0003.JPG.ext2.ext2.ext2
IMAG0005.JPG.ext2.ext2.ext2
IMAG0006.JPG.ext2.ext2.ext2

 ## filerenamer.py -s "IMAG(\d+)\.JPG.*" -e "CUBA01:99.JPG" -l -n "IMAG*" #remove -l to commit
==>>>>  [ /home/IMAG0001.JPG ]==>[ /home/CUBA01.JPG ]
==>>>>  [ /home/IMAG0002.JPG.ext2.ext2.ext2 ]==>[ /home/CUBA02.JPG ]
==>>>>  [ /home/IMAG0003.JPG.ext2.ext2.ext2 ]==>[ /home/CUBA03.JPG ]
==>>>>  [ /home/IMAG0005.JPG.ext2.ext2.ext2 ]==>[ /home/CUBA04.JPG ]
==>>>>  [ /home/IMAG0006.JPG.ext2.ext2.ext2 ]==>[ /home/CUBA05.JPG ]
 
# filerenamer.py -s "IMAG(\d+)\.JPG.*" -e "CUBA01:99.JPG"  -n "IMAG*"
/home/IMAG0001.JPG  is renamed to  /home/CUBA01.JPG
/home/IMAG0002.JPG.ext2.ext2.ext2  is renamed to  /home/CUBA02.JPG
/home/IMAG0003.JPG.ext2.ext2.ext2  is renamed to  /home/CUBA03.JPG
/home/IMAG0005.JPG.ext2.ext2.ext2  is renamed to  /home/CUBA04.JPG
/home/IMAG0006.JPG.ext2.ext2.ext2  is renamed to  /home/CUBA05.JPG


# ls -1
CUBA01.JPG
CUBA02.JPG
CUBA03.JPG
CUBA04.JPG
CUBA05.JPG


Last edited by ghostdog74; 10-07-2008 at 08:40 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Renaming multiple files

Can someone please tell me how I can rename a bunch of files at a time. I hava a directory that has 700+ files that are named *.xyz and I would like to rename them to *.abc . How can I do that with a simple command ? mv *.xyz *.abc did not work. Thanks in advance (4 Replies)
Discussion started by: jxh461
4 Replies

2. UNIX for Dummies Questions & Answers

Renaming of multiple filenames

Hi All, I need to rename the file names. I need to rename for example as follows file001 to flat1 file100 to flat100 Thanks Shash :confused: (7 Replies)
Discussion started by: shashi_kiran_v
7 Replies

3. UNIX for Dummies Questions & Answers

Renaming Multiple files

Hi All my dear friends I had multiple files in my directory with .pcv and .sqv extn I want to rename all .pcv files with .pc extn and all .sqv files with .sql extn Please help me out.:eek::mad::rolleyes: e.g. /trimsbld/users/dhirens/scripts/newfolder==>ll -rt total 2856 -rwxr-xr-x 1... (2 Replies)
Discussion started by: dhiren_shah
2 Replies

4. UNIX for Dummies Questions & Answers

Removing prefix from multiple files and renaming file extension

Hello i have the files in this format pdb1i0t.ent pdb1lv7.ent pdb1pp6.ent pdb1tj2.ent pdb1xg2.ent pdb2b4b.ent pdb2ewe.ent Now i have to remove the prefix pdb from all the files and also i need to change the extension of .ent to .txt The new file should look like this ... (3 Replies)
Discussion started by: empyrean
3 Replies

5. Shell Programming and Scripting

renaming multiple files

I have to rename 100+ files at a time on the server & was trying to use a script for doing that. I have used ultra edit to create a file having current filename & new file name as below file234.txt | file956.txt file687.txt | file385.txt There is no fixed pattern while renaming & would... (20 Replies)
Discussion started by: crux123
20 Replies

6. UNIX for Dummies Questions & Answers

Renaming multiple files

Hi, Can we rename multiples files using find or awk utility? Now I am doing it using for loop and getting the file name and in side the loop using the mv command. Like ine need t rename all txt files to doc file. For example a1.txt => a1.doc a2.txt => a2.doc a3.txt => a3.doc myfile.txt... (2 Replies)
Discussion started by: siba.s.nayak
2 Replies

7. Shell Programming and Scripting

Renaming multiple files

I have 34 file in a directory that all have different names, however, they do have 1 pattern in commmon. They all have "-10-11-2010" date format in the name. I want to replace the date in the file name with a supplied date or maybe even the system date. I am sure I will be using awk or sed to... (9 Replies)
Discussion started by: Harleyrci
9 Replies

8. Shell Programming and Scripting

Renaming file that has multiple numbers as filename

Hi I have a file with filename as "partition-setup-and-ipl.vtcmd.76217657132.9721536798" Now i need to move this file as "partition-setup-and-ipl.vtcmd.76217657132.9721536798_org" i tried with # ls | grep -E "partition-setup-and-ipl.vtcmd.+"... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

9. Shell Programming and Scripting

Multiple File renaming with a twist

Hi I can do simple file renaming but this task is slightly more troublesome Ive got a guy that gives me multiple .pdf filles in a directory named something like 3412345.pdf 4565465.pdf 8534534.pdf And he also gives me a html file which is tabled with which shows the filenames above... (2 Replies)
Discussion started by: messiah1
2 Replies

10. Shell Programming and Scripting

Splitting file into multiple files and renaming them

Hi all, Newbie here. First of all, sorry if I made any mistakes while posting this question in terms of rules. Correct me if I am wrong. :b: I have a .dat file whose name is in the format of 20170311_abc_xyz.dat. The file consists of records whose first column consists of multiple dates in... (2 Replies)
Discussion started by: chanduris
2 Replies
GIT-MV(1)							    Git Manual								 GIT-MV(1)

NAME
git-mv - Move or rename a file, a directory, or a symlink SYNOPSIS
git mv <options>... <args>... DESCRIPTION
Move or rename a file, directory or symlink. git mv [-v] [-f] [-n] [-k] <source> <destination> git mv [-v] [-f] [-n] [-k] <source> ... <destination directory> In the first form, it renames <source>, which must exist and be either a file, symlink or directory, to <destination>. In the second form, the last argument has to be an existing directory; the given sources will be moved into this directory. The index is updated after successful completion, but the change must still be committed. OPTIONS
-f, --force Force renaming or moving of a file even if the target exists -k Skip move or rename actions which would lead to an error condition. An error happens when a source is neither existing nor controlled by Git, or when it would overwrite an existing file unless -f is given. -n, --dry-run Do nothing; only show what would happen -v, --verbose Report the names of files as they are moved. SUBMODULES
Moving a submodule using a gitfile (which means they were cloned with a Git version 1.7.8 or newer) will update the gitfile and core.worktree setting to make the submodule work in the new location. It also will attempt to update the submodule.<name>.path setting in the gitmodules(5) file and stage that file (unless -n is used). GIT
Part of the git(1) suite Git 1.8.5.3 01/14/2014 GIT-MV(1)
All times are GMT -4. The time now is 12:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy