PDA

View Full Version : File Editing Software Request.


eniqmah
December 13th, 2008, 02:30 AM
Hello,
I have a lot of files in the following format:

ThisIsTheFileNameButAsYouCanSeeItNeedsSpacesBetweenWords.jpg


I'd like a batch renaming program with the capabilities to separate these words. If you know of any, please let me know. Thanks.

Mrkvonic
December 13th, 2008, 02:39 AM
Hello,
You need space before the capital letter is it? Or is it random?
I could give you a Linux script that does this, would that work?
Mrk

InfinityAz
December 13th, 2008, 02:54 AM
enigmah,

Here's a bunch (http://www.snapfiles.com/Freeware/system/fwfilerename.html). I personally like ReNamer and Rename Master. Both are very good, it's just a matter of personal preference.

eniqmah
December 13th, 2008, 05:47 AM
Hi,
I basically need to turn:
"ThisIsTheFileNameButAsYouCanSeeItNeedsSpacesBetweenWords.jpg"
into
"This Is The File Name But As You Can See It Needs Spaces Between Words.jpg"

For a long list of files.

A script would be wonderful. Let me know if you have time to write it. Thanks.

Mrkvonic
December 13th, 2008, 01:13 PM
Hello,

Here's all you need to do:


ls | sed 's/[A-Z]/ &/g' | sed 's/^ //'


Magic, eh? And if there are numbers, too, then:


ls | sed 's/[A-Z,0-9]/ &/g' | sed 's/^ //'


And if you want a nice script:


#!/bin/bash

list=$(ls)

for i in $list ; do
tempnewname=$(echo "$i" | sed 's/[A-Z,0-9]/ &/g')
newname=$(echo "$tempnewname" | sed 's/^ //')
if [ "$i" != "$newname" ] ; then
mv "$i" "$newname"
fi
done

exit 0


Cheers,
Mrk

eniqmah
December 13th, 2008, 02:09 PM
Hi,
Thanks!
I might have missed something, I saved all three parts as separate bat files and ran them in a folder containing those aforementioned files. Nothing happened. What did I do wrong?

Mrkvonic
December 13th, 2008, 02:35 PM
Hi,

You only need the last one, the others are to demonstrate what is being done.

It's a Linux script, you noticed ... :)

You need to make it executable, using chmod +x script-name.

And then run it in desired folder.

Mrk

eniqmah
December 13th, 2008, 03:17 PM
Hi,
This is way over my head, never used chmod or anything like it before.

HAN
December 13th, 2008, 03:25 PM
If you don't end up using the Mrkvonic's script, from the list InfinityAz gave, I prefer Bulk Rename Utility http://www.snapfiles.com/get/bulkrename.html It's the only rename program I use anymore (I use it with mp3's.)

eniqmah
December 13th, 2008, 03:48 PM
-{ Quote: "If you don't end up using the Mrkvonic's script, from the list InfinityAz gave, I prefer Bulk Rename Utility http://www.snapfiles.com/get/bulkrename.html It's the only rename program I use anymore (I use it with mp3's.)" }-

I also have that utility, but it doesn't have that kind of functionality.
These utilities are generic insofar as they're able to manipulate file names which have separate words, but complicated functions, no way.

MrBrian
December 18th, 2008, 12:21 AM
Use Bulk Rename Utility.

In RegEx section, set
Match='((([^A-Z])|(^[A-Z])|(\s+[A-Z]))*)(\S)([A-Z])(.*)' (without outer quotes)
Replace='\1\6 \7\8' (without outer quotes)

Each time you push 'Rename', one space at most is added to a filename. Thus, you'll have to push 'Rename' multiple times, until no more changes are made. Make sure to run this on copies at first, in case there are bugs in the above solution, since I didn't test it thoroughly.

eniqmah
December 18th, 2008, 10:36 AM
This works. Brilliant. Thanks.