Results 1 to 7 of 7
Hybrid View
-
23rd Jun 2009, 12:08 AM #1OPMemberWebsite's:
InvestDude.comRenaming 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 appreciatedCrucify 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: 5InvestDude.com Learn to make money by investing in hyips (high yield investment programs), affiliate marketing and tons of other method ;)
-
28th Jun 2009, 11:00 PM #2Member
Suffix
Code:for i in *.rar; do mv "$i" "`basename $i .rar`_[sitename].rar"; done
Code:find *.rar -exec mv {} [sitename]_{} \;
-
29th Jun 2009, 10:27 AM #3OPMemberWebsite's:
InvestDude.comfor prefixing i use
Code:for i in * ; do mv $i [sitename]_${i#} ; done
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 ;)
-
29th Jun 2009, 11:09 AM #4It 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.
-
29th Jun 2009, 11:28 AM #5Member
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
-
29th Jun 2009, 03:02 PM #6Member
Sorry about the double post, just wanted to bump this to make it abundantly clear...
I made a silly typoSorry about that CrucifynDi3, heh
Suffix
Code:for i in *.rar; do mv "$i" "`basename $i .rar`_[sitename].rar"; done
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.
Just a bit more complicated than a prefix because it needs to hold the file name before temporarily in memory.
-
29th Jun 2009, 04:37 PM #7OPMemberWebsite's:
InvestDude.comyess, 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 ;)
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
[Other] RDP - Files Renaming
By viruz99 in forum ArchiveReplies: 14Last Post: 19th Oct 2011, 06:21 PM -
Rar Multiple Avi Files At Once, How To?
By TexWilliams in forum Webmaster DiscussionReplies: 4Last Post: 4th Jul 2011, 11:09 AM -
Multiple Files Search & Replace
By soft2050 in forum Webmaster ResourcesReplies: 14Last Post: 11th Mar 2011, 09:26 PM -
Help in renaming files.
By chromer19 in forum Technical Help Desk SupportReplies: 4Last Post: 26th Feb 2011, 11:14 PM -
Changing MD5 on multiple files on my computer
By rosinant in forum Technical Help Desk SupportReplies: 1Last Post: 1st Dec 2010, 09:27 PM
themaCreator - create posts from...
Version 3.47 released. Open older version (or...