Activity Stream
48,167 MEMBERS
6801 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 7 of 7

Hybrid View

Crucify Renaming Multiple Files in SSH 23rd Jun 2009, 12:08 AM
Juo Suffix for i in *.rar; do mv... 28th Jun 2009, 11:00 PM
Crucify for prefixing i use for i in... 29th Jun 2009, 10:27 AM
Lifetalk The suffix code looks like it's... 29th Jun 2009, 11:09 AM
Juo No idea why it wont work, this is... 29th Jun 2009, 11:28 AM
Juo Sorry about the double post, just... 29th Jun 2009, 03:02 PM
Crucify yess, that works perfect Juo! :D... 29th Jun 2009, 04:37 PM
Previous Post Previous Post   Next Post Next Post
  1.     
    #1
    Member
    Website's:
    InvestDude.com

    Default Renaming Multiple Files in SSH

    need a little help with renaming multiple files....

    I can batch rename files to add Prefixes or replace blank spaces to underscores...
    but what I am unable to do is to add suffixes to all the files in a directory

    I have files such as
    filename.rar
    filename2.rar
    filename3.rar

    I want to add suffix like this..
    filename_[sitename].rar
    filename2_[sitename].rar
    filename3_[sitename].rar


    any help or clue is really appreciated
    Crucify Reviewed by Crucify on . Renaming Multiple Files in SSH need a little help with renaming multiple files.... I can batch rename files to add Prefixes or replace blank spaces to underscores... but what I am unable to do is to add suffixes to all the files in a directory I have files such as filename.rar filename2.rar filename3.rar Rating: 5
    InvestDude.com Learn to make money by investing in hyips (high yield investment programs), affiliate marketing and tons of other method ;)

  2.   Sponsored Links

  3.     
    #2
    Member
    Suffix
    Code: 
    for i in *.rar; do mv "$i" "`basename $i .rar`_[sitename].rar"; done
    Prefix
    Code: 
    find *.rar -exec mv {} [sitename]_{} \;
    Hope that helps.

  4.     
    #3
    Member
    Website's:
    InvestDude.com
    for prefixing i use

    Code: 
    for i in * ; do mv $i [sitename]_${i#} ; done
    but your one's working too...


    unfortunately the suffix is still not working...when executed it shows...

    mv: cannot stat `\223102-AF.rar\224': No such file or directory

    any idea why?
    InvestDude.com Learn to make money by investing in hyips (high yield investment programs), affiliate marketing and tons of other method ;)

  5.     
    #4
    It begins...
    The suffix code looks like it's trying to add a suffix after the .rar extension and adding a .rar to the entire file name after the suffix.

    No idea though, on why the rename fails. I haven't tried it.

  6.     
    #5
    Member
    No idea why it wont work, this is the result I get;

    cd test
    ls
    filename.rar filename2.rar filename3.rar
    for i in *.rar; do mv "$i" "`basename $i .rar`_[sitename].rar"; done
    ls
    filename_[sitename].rar filename3_[sitename].rar filename2_[sitename].rar

  7.     
    #6
    Member
    Sorry about the double post, just wanted to bump this to make it abundantly clear...


    I made a silly typo Sorry about that CrucifynDi3, heh

    Suffix
    Code: 
    for i in *.rar; do mv "$i" "`basename $i .rar`_[sitename].rar"; done
    EDIT: Updated all my posts so if someone stumbles across this thread it wont cause confusion.

    Hope that helps.

    The suffix code looks like it's trying to add a suffix after the .rar extension and adding a .rar to the entire file name after the suffix.
    It just renames each file by removing the .rar, then it renaming the file it to _[sitename].rar.
    Just a bit more complicated than a prefix because it needs to hold the file name before temporarily in memory.

  8.     
    #7
    Member
    Website's:
    InvestDude.com
    yess, that works perfect Juo!
    after so many days a working solution lol.

    btw, just out of curiousity, which part removes the .rar? im assuming its $i .rar?

    Anywayz, thanx to both Juo for the code and also to lifetalk for the alternative solution you gave thru PM.
    InvestDude.com Learn to make money by investing in hyips (high yield investment programs), affiliate marketing and tons of other method ;)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Other] RDP - Files Renaming
    By viruz99 in forum Archive
    Replies: 14
    Last Post: 19th Oct 2011, 06:21 PM
  2. Rar Multiple Avi Files At Once, How To?
    By TexWilliams in forum Webmaster Discussion
    Replies: 4
    Last Post: 4th Jul 2011, 11:09 AM
  3. Multiple Files Search & Replace
    By soft2050 in forum Webmaster Resources
    Replies: 14
    Last Post: 11th Mar 2011, 09:26 PM
  4. Help in renaming files.
    By chromer19 in forum Technical Help Desk Support
    Replies: 4
    Last Post: 26th Feb 2011, 11:14 PM
  5. Changing MD5 on multiple files on my computer
    By rosinant in forum Technical Help Desk Support
    Replies: 1
    Last Post: 1st Dec 2010, 09:27 PM

Tags for this Thread

BE SOCIAL