File Editing Software Request.

Discussion in 'other software & services' started by eniqmah, Dec 13, 2008.

Thread Status:
Not open for further replies.
  1. eniqmah

    eniqmah Registered Member

    Joined:
    Jul 7, 2006
    Posts:
    391
    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.
     
  2. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,698
    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
     
  3. InfinityAz

    InfinityAz Registered Member

    Joined:
    Jul 23, 2005
    Posts:
    828
    Location:
    Arizona
    enigmah,

    Here's a bunch. I personally like ReNamer and Rename Master. Both are very good, it's just a matter of personal preference.
     
  4. eniqmah

    eniqmah Registered Member

    Joined:
    Jul 7, 2006
    Posts:
    391
    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.
     
  5. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,698
    Hello,

    Here's all you need to do:

    Code:
    ls | sed 's/[A-Z]/ &/g' | sed 's/^ //'
    
    Magic, eh? And if there are numbers, too, then:

    Code:
    ls | sed 's/[A-Z,0-9]/ &/g' | sed 's/^ //'
    
    And if you want a nice script:

    Code:
    #!/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
     
    Last edited: Dec 13, 2008
  6. eniqmah

    eniqmah Registered Member

    Joined:
    Jul 7, 2006
    Posts:
    391
    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?
     
  7. Mrkvonic

    Mrkvonic Linux Systems Expert

    Joined:
    May 9, 2005
    Posts:
    8,698
    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
     
  8. eniqmah

    eniqmah Registered Member

    Joined:
    Jul 7, 2006
    Posts:
    391
    Hi,
    This is way over my head, never used chmod or anything like it before.
     
  9. HAN

    HAN Registered Member

    Joined:
    Feb 24, 2005
    Posts:
    2,080
    Location:
    USA
    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.)
     
  10. eniqmah

    eniqmah Registered Member

    Joined:
    Jul 7, 2006
    Posts:
    391
    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.
     
  11. MrBrian

    MrBrian Registered Member

    Joined:
    Feb 24, 2008
    Posts:
    6,032
    Location:
    USA
    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.
     
  12. eniqmah

    eniqmah Registered Member

    Joined:
    Jul 7, 2006
    Posts:
    391
    This works. Brilliant. Thanks.
     
Loading...
Thread Status:
Not open for further replies.