Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Easy way to mass rename files? Post 19876 by Thermopylae on Wednesday 17th of April 2002 01:49:13 PM
Old 04-17-2002
Yes, I am aware of that. But due to to way my site is designed that is not a big issue, in fact in the few cases where links would break I can do a grep and fix that.

But the rename php was merely an example, I am interested in ways to mass rename files...

Thanks.
 

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
RENAME(2)						     Linux Programmer's Manual							 RENAME(2)

NAME
rename - change the name or location of a file SYNOPSIS
#include <stdio.h> int rename(const char *oldpath, const char *newpath); DESCRIPTION
rename() renames a file, moving it between directories if required. Any other hard links to the file (as created using link(2)) are unaf- fected. Open file descriptors for oldpath are also unaffected. If newpath already exists it will be atomically replaced (subject to a few conditions; see ERRORS below), so that there is no point at which another process attempting to access newpath will find it missing. If oldpath and newpath are existing hard links referring to the same file, then rename() does nothing, and returns a success status. If newpath exists but the operation fails for some reason rename() guarantees to leave an instance of newpath in place. oldpath can specify a directory. In this case, newpath must either not exist, or it must specify an empty directory. However, when overwriting there will probably be a window in which both oldpath and newpath refer to the file being renamed. If oldpath refers to a symbolic link the link is renamed; if newpath refers to a symbolic link the link will be overwritten. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EACCES Write permission is denied for the directory containing oldpath or newpath, or, search permission is denied for one of the directo- ries in the path prefix of oldpath or newpath, or oldpath is a directory and does not allow write permission (needed to update the .. entry). (See also path_resolution(7).) EBUSY The rename fails because oldpath or newpath is a directory that is in use by some process (perhaps as current working directory, or as root directory, or because it was open for reading) or is in use by the system (for example as mount point), while the system considers this an error. (Note that there is no requirement to return EBUSY in such cases -- there is nothing wrong with doing the rename anyway -- but it is allowed to return EBUSY if the system cannot otherwise handle such situations.) EFAULT oldpath or newpath points outside your accessible address space. EINVAL The new pathname contained a path prefix of the old, or, more generally, an attempt was made to make a directory a subdirectory of itself. EISDIR newpath is an existing directory, but oldpath is not a directory. ELOOP Too many symbolic links were encountered in resolving oldpath or newpath. EMLINK oldpath already has the maximum number of links to it, or it was a directory and the directory containing newpath has the maximum number of links. ENAMETOOLONG oldpath or newpath was too long. ENOENT The link named by oldpath does not exist; or, a directory component in newpath does not exist; or, oldpath or newpath is an empty string. ENOMEM Insufficient kernel memory was available. ENOSPC The device containing the file has no room for the new directory entry. ENOTDIR A component used as a directory in oldpath or newpath is not, in fact, a directory. Or, oldpath is a directory, and newpath exists but is not a directory. ENOTEMPTY or EEXIST newpath is a nonempty directory, that is, contains entries other than "." and "..". EPERM or EACCES The directory containing oldpath has the sticky bit (S_ISVTX) set and the process's effective user ID is neither the user ID of the file to be deleted nor that of the directory containing it, and the process is not privileged (Linux: does not have the CAP_FOWNER capability); or newpath is an existing file and the directory containing it has the sticky bit set and the process's effective user ID is neither the user ID of the file to be replaced nor that of the directory containing it, and the process is not privileged (Linux: does not have the CAP_FOWNER capability); or the file system containing pathname does not support renaming of the type requested. EROFS The file is on a read-only file system. EXDEV oldpath and newpath are not on the same mounted file system. (Linux permits a file system to be mounted at multiple points, but rename() does not work across different mount points, even if the same file system is mounted on both.) CONFORMING TO
4.3BSD, C89, C99, POSIX.1-2001. BUGS
On NFS file systems, you can not assume that if the operation failed the file was not renamed. If the server does the rename operation and then crashes, the retransmitted RPC which will be processed when the server is up again causes a failure. The application is expected to deal with this. See link(2) for a similar problem. SEE ALSO
mv(1), chmod(2), link(2), renameat(2), symlink(2), unlink(2), path_resolution(7), symlink(7) COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2009-03-30 RENAME(2)
All times are GMT -4. The time now is 11:41 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy