View previous topic :: View next topic |
Author |
Message |
Lockup Guru
Joined: 25 Jul 2002 Posts: 430
|
Posted: Mon Jan 20, 2003 7:02 pm Post subject: mv and multiple files |
|
|
is there some kind of alternative to 'mv' (or another shell i dunno...) that supports multiple files on move? for example:
kinda like old-style dos...
i looked around a bit but im not even sure WHAT to look for(the words...[/code] |
|
Back to top |
|
|
aja l33t
Joined: 26 Aug 2002 Posts: 705 Location: Edmonton, Canada
|
Posted: Mon Jan 20, 2003 7:09 pm Post subject: |
|
|
The Linux Cookbook mentions a perl script called chcase for that use. A google would probably turn it up. |
|
Back to top |
|
|
gzaector Tux's lil' helper
Joined: 24 Nov 2002 Posts: 132 Location: 304
|
Posted: Mon Jan 20, 2003 7:35 pm Post subject: |
|
|
you could try putting everything into a directory then copying that, then deleting it
Code: |
cp -r dir dest; rm -rf dir
|
just a suggestion
-gza |
|
Back to top |
|
|
pjp Administrator
Joined: 16 Apr 2002 Posts: 20067
|
Posted: Mon Jan 20, 2003 8:38 pm Post subject: |
|
|
Check out rename, which is part of the util-linux package. _________________ Quis separabit? Quo animo? |
|
Back to top |
|
|
Lockup Guru
Joined: 25 Jul 2002 Posts: 430
|
Posted: Mon Jan 20, 2003 11:05 pm Post subject: |
|
|
thanks ill look into rename and that perl script |
|
Back to top |
|
|
ebrostig Bodhisattva
Joined: 20 Jul 2002 Posts: 3152 Location: Orlando, Fl
|
Posted: Mon Jan 20, 2003 11:34 pm Post subject: |
|
|
Another method is using shellscripts.
Code: |
for i in *.mp3
do
mv $i `basename $i .mp3`.blah
done
|
This renames all your .mp3 files to .blah.
Just type in the command at yhe command prompt and hit enter to run it.
Erik _________________ 'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.' |
|
Back to top |
|
|
Kaali Tux's lil' helper
Joined: 12 May 2002 Posts: 80
|
Posted: Tue Jan 21, 2003 12:43 am Post subject: |
|
|
ebrostig wrote: | Another method is using shellscripts.
Code: |
for i in *.mp3
do
mv $i `basename $i .mp3`.blah
done
|
This renames all your .mp3 files to .blah.
Just type in the command at yhe command prompt and hit enter to run it.
Erik |
Or use mostly unknown feature in Bash to tweak ebrostigs code a bit:
Code: |
for i in *.mp3; do mv $i ${i/.mp3/.blah}; done
|
|
|
Back to top |
|
|
ebrostig Bodhisattva
Joined: 20 Jul 2002 Posts: 3152 Location: Orlando, Fl
|
Posted: Tue Jan 21, 2003 12:47 am Post subject: |
|
|
Great!
I was not aware of that feature
I'm not doing enough shell programming these days.
Erik _________________ 'Yes, Firefox is indeed greater than women. Can women block pops up for you? No. Can Firefox show you naked women? Yes.' |
|
Back to top |
|
|
bdonlan n00b
Joined: 21 Jan 2003 Posts: 44
|
Posted: Tue Jan 21, 2003 12:49 am Post subject: Not directly... |
|
|
Try:
Code: | for mp3 in *.mp3; do mv "$mp3" "$(echo $mp3 | sed 's/[.]mp3$/.blah')"; done |
|
|
Back to top |
|
|
linut n00b
Joined: 07 Dec 2002 Posts: 18
|
Posted: Tue Jan 21, 2003 10:09 pm Post subject: |
|
|
Quote: | is there some kind of alternative to 'mv' |
You might like mmv or ren. They are in portage. |
|
Back to top |
|
|
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Wed Jan 22, 2003 12:10 am Post subject: |
|
|
find and xargs are another alternative to the shell scripting approach. _________________ For every higher wall, there is a taller ladder |
|
Back to top |
|
|
|