mv or something else

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?
franzi [ So, 06 April 2008 17:24 ] [ ID #1936437 ]

Re: mv or something else

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
Johann Kappacher [ So, 06 April 2008 17:44 ] [ ID #1936438 ]

Re: mv or something else

Post removed (X-No-Archive: yes)
Notifier Deamon [ So, 06 April 2008 18:17 ] [ ID #1936439 ]

Re: mv or something else

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) :-)
Johann Kappacher [ So, 06 April 2008 18:33 ] [ ID #1936441 ]

Re: mv or something else

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.
PK [ So, 06 April 2008 19:05 ] [ ID #1936444 ]

Re: mv or something else

On 6 Apr, 19:05, pk <p... [at] pk.invalid> 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
franzi [ Mo, 07 April 2008 04:57 ] [ ID #1936874 ]

Re: mv or something else

On 6 Apr., 19:05, pk <p... [at] pk.invalid> 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/*. [at] (avi|txt|jpg|odt) /root/dirx


Janis
Janis Papanagnou [ Mo, 07 April 2008 11:55 ] [ ID #1936886 ]

Re: mv or something else

Janis wrote:

>> or, with bash and maybe some other shell
>>
>> $ mv /home/*.{avi,txt,jpg,odt} /root/dirx
>
> In Kornshell it's...
>
> $ mv /home/*. [at] (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.
PK [ Mo, 07 April 2008 12:21 ] [ ID #1936888 ]

Re: mv or something else

On 7 Apr., 12:21, pk <p... [at] pk.invalid> 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
>
Janis Papanagnou [ Mo, 07 April 2008 14:11 ] [ ID #1936890 ]

Re: mv or something else

On 2008-04-07, Janis <janis_papanagnou [at] hotmail.com> wrote:
> On 7 Apr., 12:21, pk <p... [at] pk.invalid> 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
Chris Mattern [ Mo, 07 April 2008 20:26 ] [ ID #1936903 ]
Linux » comp.unix.shell » mv or something else

Vorheriges Thema: spliting a string.
Nächstes Thema: sed