rename

Bash script to pad file names

What is the best way, using Bash, to rename files in the form: (foo1, foo2, ..., foo1300, ..., fooN) With zero-padded file names: (foo00001, foo00002, ..., foo01300, ..., fooN) ...

Batch renaming of files with international chars on Windows XP

I have a whole bunch of files with filenames using our lovely Swedish letters å å and ö. For various reasons I now need to convert these to an [a-zA-Z] range. Just removing anything outside this range is fairly easy. The thing that's causing me trouble is that I'd like to replace å with a, ö with o and so on. This is charset troubles a...

How do I rename a SharePoint virtual machine

I am using virtual machines for development,but each time I need a new VM, I copy the file and create a new server, but I need a new name for the server to add it to our network. After renaming the server, the Sharepoint sites have many errors and do not run. ...

How to rename all folders and files to lowercase on Linux?

I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ sourcecode, but that shouldn't matter). Bonus points for ignoring CVS and SVN control files/folders. Preferred way would be a shell script, since shell should be available at any Linux box. There were some valid arguments about det...

How do I rename a column in a database table using SQL?

If I wish to simply rename a column (not change its type or constraints, just its name) in an SQL database using SQL, how do I do that? Or is it not possible? This is for any database claiming to support SQL, I'm simply looking for an SQL-specific query that will work regardless of actual database implementation. ...

Renaming Tables SQL Server, cascading that change through PK and FK's

I want to find a sql command or something that can do this where I have a table named tblFoo and I want to name it tblFooBar. However, I want the primary key to also be change, for example, currently it is: CONSTRAINT [PK_tblFoo] PRIMARY KEY CLUSTERED And I want a name change to change it to: CONSTRAINT [PK_tblFooBar] PRIMARY KEY CLU...

Why do I get "permission denied" in PHP when trying to rename a directory?

I chmod'ed the directory to 777, same with the directory contents. Still, I get a "permission denied" error. Does PHP throw this error if apache is not the group/owner, regardless of the file permissions? Here's the call that's failing: rename('/correct/path/to/dir/1', '/correct/path/to/dir/2'); ...

Capitalize every file in a directory, in bash, using 'svn mv'.

I need to change the capitalization of a set of files in a subversion working copy, like so: svn mv test.txt Test.txt svn mv test2.txt Test2.txt svn mv testn.txt Testn.txt ... svn commit -m "caps" How can I automate this process? Standard linux install tools available. ...

How to rename with prefix/suffix ?

How do I do mv original.filename new.original.filename without retyping the original filename? I would imagine being able to do something like mv -p=new. original.filename or perhaps mv original.filename new.~ or whatever - but I can't see anything like this after looking at man mv / info mv pages. Of course, I could write a shell scri...

How to cascade rename PK on table, MS SQL 2005

I have successfully been able to rename a table and drop all constraints on that table with foreign key relationships and build they all back up. However, now I am at a point where the PK_tblFoo exists in more than one place (when I transfer the table to another DB). Renaming the table does not rename the primary key. How would I cascad...

SQL Server 2005, need script to check for all constraints on table

I continue to get this error: Object '%s' cannot be renamed because the object participates in enforced dependencies I need to find a script that will help me to find all the dependencies that there is with this table. I will need to drop them, rename, then bring them back. Thanks. SQL Server 2005 ...

mysql duplicate entry error when there is no duplicate entry (bulk load via php)

i am using mysql (5.0.32-Debian_7etch6-log) and i've got a nightly running bulk load php (5.2.6) script (using Zend_DB (1.5.1) via PDO) which does the following: truncating a set of 4 'import' tables bulk inserting data into these 4 'import' tables (re-using ids that have previously been in the tables as well, but i truncated the whole...

Batch Renaming of Files in a Directory

Is there an easy way to rename a group of files already contained in a directory, using Python? Example: I have a directory full of *.doc files and I want to rename them in a consistent way. X.doc -> "new(X).doc" Y.doc -> "new(Y).doc" ...

Rename existing files in XP useing a batch file (Backup purpose)

pkzip25 -add=all -dir=current -silent -locale -exclude=DistData.zip -exclude=extract.bat -exclude=run.bat -exclude=pkzip25.exe -exclude=extracted.txt -exclude=zipped.txt -exclude=.\STORE DistData.zip *.* pkzip25 -view -directories DistData.zip >zipped.txt copy DistData.zip ..\BKX\DistData_1.zip CD\BKX rename DistData_1.zip DistData_2.zi...

How to rename exe file

Say I've got a generic vertical market application and I want to package it as two separate programs aaa.exe and bbb.exe. Is there any way to use the Delphi linker to create an EXE/DLL file that doesn't have the same name as the DPR? I can't just rename the file because I get this error bbb.exe - Unable to to locate component ...

What's the best way to do a cross-platform, atomic file replacement in Perl?

I have a very common situation. I have a file, and I need to entirely overwrite that file with new contents. However, the original file is accessed on every page load (this is a web app), so it can't be missing for very long. A few ms is OK (though not ideal), a second is not OK. Right now I do this by writing a temp file to the same di...

How to do a mass rename?

I need to rename files names like this "transform.php?dappName=Test&transformer=YAML&v_id=XXXXX" to just this "XXXXX.txt" How can I do it? I understand that i need more than one "mv" command because they are at least 25000 files. Thanks! ...

Deleting files securely in delphi7

Problem I want to securely delete a file in windows XP. Context I need to delete my input file securely once i have finished with it, at the moment i am over writing all the data with zero, this is messy as my temp folder becomes full of old files also the name of the files is a security issue, rather than just moving them to the recycl...

Rename files, Python/Jython

I have a directory full of files, some which have an ampersand in their names. I would like to rename all the files with ampersands and replace each ampersand with a plus (+). I am working with around 10k files. What would be the best method to do this? ...

How do I rename a filename after uploading with php?

How do I rename the file either before or after it gets uploaded? I just want to rename the filename, not the extension. $changeTXT = $_SESSION['username']; $uploaderName = strtolower($changeTXT); $changeTXT = strtolower($changeTXT); $changeTXT = ucfirst($changeTXT); $filelocation = $_POST['userfile']; $filename = $_POST['filename']; $m...