Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Easy way to mass rename files? Post 19952 by TRUEST on Thursday 18th of April 2002 10:02:58 AM
Old 04-18-2002
I think the easiest and simplest thing to do is to find all this range of files you want to rename and then do the mv command on them.

Or

you can put only the wanted files in a specific directory and then do as you please



for file in (directory where the files are in)
do
mv $file $file.php
done
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Mass Copy/rename

Don't tell me DOS can do something UNIX can't do! I want to copy a number of files from one directory to another, and at the same time change the names. The name changes would be common, e.g., all files starting with the letter 'L' and ending in '30.NEW554', with the copied or new files also... (6 Replies)
Discussion started by: lwilsonFG
6 Replies

2. Shell Programming and Scripting

Mass Change content in all files

Hi, Are there any sample scripts to change content like file paths, profile paths etc., from test version to production , instead of changing one by one, i would like to pass the in file (prod version/Test version) to convert to test or prod verions. any help is appreciated!! ~R (1 Reply)
Discussion started by: terala
1 Replies

3. AIX

VI questions : mass changes, mass delete and external insert

Is it possible in VI to do a global change but take the search patterns and the replacement patterns from an external file ? I have cases where I can have 100,200 or 300+ global changes to do. All the new records are inside a file and I must VI a work file to change all of them. Also, can... (1 Reply)
Discussion started by: Browser_ice
1 Replies

4. UNIX for Dummies Questions & Answers

Need help on installing an EASY to use and easy to install command line text editor

Hi again. Sorry if it seems like I'm spamming the boards a bit, but I figured I might as well ask all the questions I need answers to at once, and hopefully at least get some. I have installed Solaris 10 on a server. The default text editors are there (vi, ex, ed, maybe others, I know emacs is... (4 Replies)
Discussion started by: EugeneG
4 Replies

5. Shell Programming and Scripting

bash script to rename in mass

Basically, I have a huge amount of files (ripped audiobooks) that all have the same garbage in their filenames. I'm wondering how to go about writing a bash script to mass rename them. Example filenames as they stand now: The First CD - 1x01 - Title 1.mp3 The First CD - 1x02 - Title 2.mp3... (4 Replies)
Discussion started by: audiophile
4 Replies

6. UNIX for Dummies Questions & Answers

Need help to mass rename files

Hi. I've got 75 mp3s that have the word 'Émission' in their filename. They are all in this format: Émission bla1 bla1.mp3 Émission bla2 bla2.mp3 Émission bla3 bla3.mp3 etc... I would just like to mass replace 'Émission' by 'Emission'; basically replace 'É' with 'E'. The rest of the... (10 Replies)
Discussion started by: Kingzy
10 Replies

7. Windows & DOS: Issues & Discussions

Windows mass copy files with same name in differnt folders

I have files existing with same names in the folders with date as display below c:\2010-09-10 <==== folder arr1.jpg arr2.jpg arr3.jpg arr4.jpg c:\2010-09-09 <==== folder arr1.jpg arr2.jpg c:\2010-09-08 <==== folder arr2.jpg arr3.jpg arr4.jpg ... (5 Replies)
Discussion started by: jville
5 Replies

8. Shell Programming and Scripting

mass renaming files with complex filenames

Hi, I've got files with names like this : _Some_Name_178_HD_.mp4 _Some_Name_-_496_Vost_SD_(720x400_XviD_MP3).avi Goffytofansub_Some name 483_HD.avi And iam trying to rename it with a regular pattern. My gola is this : Ep 178.mp4 Ep 496.avi Ep 483.avi I've tried using sed with... (8 Replies)
Discussion started by: VLaw
8 Replies

9. Programming

Minor editing of mass HTML files

Hello, I'm manipulating a batch of about 2,000 HTML files. I just need to make some small changes, but to all the files at once. For example, I want to delete the lines that have "embed_music" in all the files, or change all instances of the word "Paragraph" to "Absatz". This is my... (2 Replies)
Discussion started by: pxalpine
2 Replies

10. Shell Programming and Scripting

Rename mass files with text from first line

I have a few hundred text files that are currently numbered files. I would like to rename each one with the text from the first line in the file. I would prefer this is perl script rather than a one liner as it wil be after many alterations to the file via an existing script. Any help would be... (1 Reply)
Discussion started by: GWhizz
1 Replies
Text::Trim(3pm) 					User Contributed Perl Documentation					   Text::Trim(3pm)

NAME
Text::Trim - remove leading and/or trailing whitespace from strings VERSION
version 1.02 SYNOPSIS
use Text::Trim; $text = " important data "; $data = trim $text; # now $data contains "important data" and $text is unchanged # or: trim $text; # work in-place, $text now contains "important data" @lines = <STDIN>; rtrim @lines; # remove trailing whitespace from all lines # Alternatively: @lines = rtrim <STDIN>; # Or even: while (<STDIN>) { trim; # Change $_ in place # ... } DESCRIPTION
This module provides functions for removing leading and/or trailing whitespace from strings. It is basically a wrapper around some simple regexes with a flexible context-based interface. EXPORTS
All functions are exported by default. CONTEXT HANDLING
void context Functions called in void context change their arguments in-place trim(@strings); # All strings in @strings are trimmed in-place ltrim($text); # remove leading whitespace on $text rtrim; # remove trailing whitespace on $_ No changes are made to arguments in non-void contexts. list context Values passed in are changed and returned without affecting the originals. @result = trim(@strings); # @strings is unchanged @result = rtrim; # @result contains rtrimmed $_ ($result) = ltrim(@strings); # like $result = ltrim($strings[0]); scalar context As list context but multiple arguments are stringified before being returned. Single arguments are unaffected. This means that under these circumstances, the value of $" ($LIST_SEPARATOR) is used to join the values. If you don't want this, make sure you only use single arguments when calling in scalar context. @strings = (" hello ", " there "); $trimmed = trim(@strings); # $trimmed = "hello there" local $" = ', '; $trimmed = trim(@strings); # Now $trimmed = "hello, there" $trimmed = rtrim; # $trimmed = $_ minus trailing whitespace Undefined values If any of the functions are called with undefined values, the behaviour is in general to pass them through unchanged. When stringifying a list (calling in scalar context with multiple arguments) undefined elements are excluded, but if all elements are undefined then the return value is also undefined. $foo = trim(undef); # $foo is undefined $foo = trim(undef, undef); # $foo is undefined @foo = trim(undef, undef); # @foo contains 2 undefined values trim(@foo) # @foo still contains 2 undefined values $foo = trim('', undef); # $foo is '' FUNCTIONS
trim Removes leading and trailing whitespace from all arguments, or $_ if none are provided. rtrim Like trim() but removes only trailing (right) whitespace. ltrim Like trim() but removes only leading (left) whitespace. UNICODE
Because this module is implemented using perl regular expressions, it is capable of recognising and removing unicode whitespace characters (such as non-breaking spaces) from scalars with the utf8 flag on. See Encode for details about the utf8 flag. Note that this only applies in the case of perl versions after 5.8.0 or so. SEE ALSO
Brent B. Powers' String::Strip performs a similar function in XS. AUTHOR
Matt Lawrence <mattlaw@cpan.org> ACKNOWLEDGEMENTS
Terrence Brannon <metaperl@gmail.com> for bringing my attention to String::Strip and suggesting documentation changes. perl v5.10.1 2010-06-07 Text::Trim(3pm)
All times are GMT -4. The time now is 03:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy