Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multiple moves
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
NewbieTim
n00b
n00b


Joined: 18 Apr 2002
Posts: 57

PostPosted: Sun May 19, 2002 10:27 am    Post subject: Multiple moves Reply with quote

hi folks,

i have the following problem. I want to "mv *.xyz *" but i can't cause the last argument has to be a directory. I also remember that there was a tool called multiple move (mmv) which can do this. Is this true ?? Where can i find this in the portage tree ?? Or is there any other way to remove suffixes ??
Back to top
View user's profile Send private message
recluse
n00b
n00b


Joined: 18 Apr 2002
Posts: 18

PostPosted: Sun May 19, 2002 4:01 pm    Post subject: Reply with quote

I don't quite understand what you want to do. Could you give a little exameple maybe? :wink:
_________________
=recluse=
Back to top
View user's profile Send private message
NewbieTim
n00b
n00b


Joined: 18 Apr 2002
Posts: 57

PostPosted: Sun May 19, 2002 4:55 pm    Post subject: Reply with quote

ok..following example. Lets say i have following files:
foo1.jpg.exe
foo2.jpg.exe
foo3.jpg.exe

i want to remove the ".exe" of all files so that i get the following:
foo1.jpg
foo2.jpg
foo3.jpg

Can't make it with mv...
Back to top
View user's profile Send private message
tomte
Tux's lil' helper
Tux's lil' helper


Joined: 08 May 2002
Posts: 122

PostPosted: Sun May 19, 2002 6:10 pm    Post subject: Reply with quote

NewbieTim wrote:
ok..following example. Lets say i have following files:
foo1.jpg.exe
foo2.jpg.exe
foo3.jpg.exe

i want to remove the ".exe" of all files so that i get the following:
foo1.jpg
foo2.jpg
foo3.jpg

Can't make it with mv...

for this particular problem:
Code:

for i in `ls --color=none *.exe`; do mv $i `basename $i .exe`; done


the apostrophs enclosing the ls and basename command are backticks,
found on the same key as the tilde on us-keyboards, bash expands this by executing the enclosed command and replaces it with the result of this command, very handy in countles situations.
for basename and the for-loop see daniel robbins bash courses, there are links to them in the documents section of gentoo.org

hth,
Tom
Back to top
View user's profile Send private message
handsomepete
Guru
Guru


Joined: 21 Apr 2002
Posts: 548
Location: Kansas City, MO

PostPosted: Sun May 19, 2002 6:32 pm    Post subject: Reply with quote

Well, you *could* do this:

Code:
ls *.exe | awk -F'.exe' '{print "mv "$0" "$1}' | sh


...or you could just take that and make it take arguments and make your own mmv script... unless you're just dying to figure out a way to do it directly with mv which I don't think is possible. But I could be wrong... :)

Edit: Oops... someone beat me to it. Cursed refresh button!
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum