mv or something else
am 06.04.2008 17:24:28 von franzi
hi there ,is there a way more efficient and fast to mv many files from
one folder to anothere one
without writing all source to the target i.e
$ mv /home/*.avi /root/dirx/ && /home/*.txt /root/dirx etc
maybe with awk?
Re: mv or something else
am 06.04.2008 17:44:20 von Johann Kappacher
franzi wrote:
> hi there ,is there a way more efficient and fast to mv many files from
> one folder to anothere one
> without writing all source to the target i.e
> $ mv /home/*.avi /root/dirx/ && /home/*.txt /root/dirx etc
> maybe with awk?
Hi, this is not a well-formed question, it is very confusing!
One hint: If source and target are inside the same filesystem, the
mv is like using rename. Thus, it is very fast.
But you cannot move files without specifying a source and a target.
A strange question, isn't it?
--jk
Re: mv or something else
am 06.04.2008 18:17:40 von unknown
Post removed (X-No-Archive: yes)
Re: mv or something else
am 06.04.2008 18:33:00 von Johann Kappacher
Cyrus Kriticos wrote:
> cd /home && mv *.avi *.txt *.foo *.bar /root/dirx
Nice try, Cyrus, but I bet that Franzi wants to avoid "write source to
target" operations, i.e. file copy operations.
If /home and /root/dirx belong to the same filesystem, then
you can use mv and it will just rename the files without writing or
copying them.
I bet 10 MMD (Mickey Mouse Dollars) :-)
Re: mv or something else
am 06.04.2008 19:05:23 von PK
franzi wrote:
> hi there ,is there a way more efficient and fast to mv many files from
> one folder to anothere one
> without writing all source to the target i.e
> $ mv /home/*.avi /root/dirx/ && /home/*.txt /root/dirx etc
I think you are missing a "mv" after && in the command above.
My take is: you want to move all avi, txt,...etc. files from /home
to /root/dirx without having to type two or more commands, each with source
and destination.
If I got that right, try this:
$ mv /home/*.avi /home/*.txt /home/*.jpg /home/*.odt /root/dirx
or, with bash and maybe some other shell
$ mv /home/*.{avi,txt,jpg,odt} /root/dirx
--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
Re: mv or something else
am 07.04.2008 04:57:57 von franzi
On 6 Apr, 19:05, pk
wrote:
> franzi wrote:
> > hi there ,is there a way more efficient and fast to mv many files from
> > one folder to anothere one
> > without writing all source to the target i.e
> > $ mv /home/*.avi /root/dirx/ && /home/*.txt /root/dirx etc
>
> I think you are missing a "mv" after && in the command above.
>
> My take is: you want to move all avi, txt,...etc. files from /home
> to /root/dirx without having to type two or more commands, each with source
> and destination.
>
> If I got that right, try this:
>
> $ mv /home/*.avi /home/*.txt /home/*.jpg /home/*.odt /root/dirx
>
> or, with bash and maybe some other shell
>
> $ mv /home/*.{avi,txt,jpg,odt} /root/dirx
>
> --
> All the commands are tested with bash and GNU tools, so they may use
> nonstandard features. I try to mention when something is nonstandard (if
> I'm aware of that), but I may miss something. Corrections are welcome.
ook guys you answerd right to me thanks very much
Re: mv or something else
am 07.04.2008 11:55:24 von Janis Papanagnou
On 6 Apr., 19:05, pk
wrote:
> franzi wrote:
> > hi there ,is there a way more efficient and fast to mv many files from
> > one folder to anothere one
> > without writing all source to the target i.e
> > $ mv /home/*.avi /root/dirx/ && /home/*.txt /root/dirx etc
>
> I think you are missing a "mv" after && in the command above.
>
> My take is: you want to move all avi, txt,...etc. files from /home
> to /root/dirx without having to type two or more commands, each with source
> and destination.
>
> If I got that right, try this:
>
> $ mv /home/*.avi /home/*.txt /home/*.jpg /home/*.odt /root/dirx
>
> or, with bash and maybe some other shell
>
> $ mv /home/*.{avi,txt,jpg,odt} /root/dirx
In Kornshell it's...
$ mv /home/*.@(avi|txt|jpg|odt) /root/dirx
Janis
Re: mv or something else
am 07.04.2008 12:21:33 von PK
Janis wrote:
>> or, with bash and maybe some other shell
>>
>> $ mv /home/*.{avi,txt,jpg,odt} /root/dirx
>
> In Kornshell it's...
>
> $ mv /home/*.@(avi|txt|jpg|odt) /root/dirx
This is actually better than mine, since it seems to expand only to those
file that actually exist. I know of no bash equivalent.
Also, slightly OT perhaps, is it normal that (on some systems) ksh is a link
to zsh? It seems to be so in the only Ubuntu system I have access to.
$ ls -l `which ksh`
lrwxrwxrwx 1 root root 29 2006-08-10
13:33 /usr/bin/ksh -> /etc/alternatives/usr.bin.ksh
$ ls -l /etc/alternatives/usr.bin.ksh
lrwxrwxrwx 1 root root 9 2007-08-23
13:41 /etc/alternatives/usr.bin.ksh -> /bin/zsh4
Thanks
--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
Re: mv or something else
am 07.04.2008 14:11:14 von Janis Papanagnou
On 7 Apr., 12:21, pk
wrote:
>
> Also, slightly OT perhaps, is it normal that (on some systems) ksh is a link
> to zsh? It seems to be so in the only Ubuntu system I have access to.
No, it is not normal; most Linuxes don't come with AT&T ksh but with
the PD ksh. Just speculating; maybe the ksh emulation of zsh is closer
to the real Kornshell? Or they want to reduce the number of different
programs, especially if they come with their own type of license.
Janis
>
> $ ls -l `which ksh`
> lrwxrwxrwx 1 root root 29 2006-08-10
> 13:33 /usr/bin/ksh -> /etc/alternatives/usr.bin.ksh
> $ ls -l /etc/alternatives/usr.bin.ksh
> lrwxrwxrwx 1 root root 9 2007-08-23
> 13:41 /etc/alternatives/usr.bin.ksh -> /bin/zsh4
>
> Thanks
>
Re: mv or something else
am 07.04.2008 20:26:41 von Chris Mattern
On 2008-04-07, Janis wrote:
> On 7 Apr., 12:21, pk wrote:
>>
>> Also, slightly OT perhaps, is it normal that (on some systems) ksh is a link
>> to zsh? It seems to be so in the only Ubuntu system I have access to.
>
> No, it is not normal; most Linuxes don't come with AT&T ksh but with
> the PD ksh. Just speculating; maybe the ksh emulation of zsh is closer
> to the real Kornshell? Or they want to reduce the number of different
> programs, especially if they come with their own type of license.
>
> Janis
>
>>
>> $ ls -l `which ksh`
>> lrwxrwxrwx 1 root root 29 2006-08-10
>> 13:33 /usr/bin/ksh -> /etc/alternatives/usr.bin.ksh
>> $ ls -l /etc/alternatives/usr.bin.ksh
>> lrwxrwxrwx 1 root root 9 2007-08-23
>> 13:41 /etc/alternatives/usr.bin.ksh -> /bin/zsh4
>>
>> Thanks
>>
>
For a long time, ksh had a license that wasn't compatible
with free systems, so they distributed with pdksh, which
is a pale imitation. ksh's license issues have been
cleared up for some years now, however, and you can
(and, IMHO, should) get real ksh for your Linux
these days as part of the standard package distribution.
--
Christopher Mattern
NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities