copy files with -- names - Suse

This is a discussion on copy files with -- names - Suse ; Hi there, unfortunatelly I do have file names that start with -- which obviously creates a problem: cp --germany--bayern--id\=40001.jpg /home/user/ does not work as cp believes that there is a command following the -- I tried to escape it with ...

+ Reply to Thread
Results 1 to 9 of 9

Thread: copy files with -- names

  1. copy files with -- names

    Hi there,

    unfortunatelly I do have file names that start with -- which obviously
    creates a problem:

    cp --germany--bayern--id\=40001.jpg /home/user/

    does not work as cp believes that there is a command following the --

    I tried to escape it with \ or " or ' but nothing worked :-(

    Any ideas?

    Thanx, Merlin

  2. Re: copy files with -- names

    Merlin Morgenstern schrieb:
    > Hi there,
    >
    > unfortunatelly I do have file names that start with -- which obviously
    > creates a problem:
    >
    > cp --germany--bayern--id\=40001.jpg /home/user/
    >
    > does not work as cp believes that there is a command following the --
    >
    > I tried to escape it with \ or " or ' but nothing worked :-(
    >
    > Any ideas?
    >
    > Thanx, Merlin


    got it:
    To remove the file `-cat' from the current directory, type:

    $ rm -- -cat [RET]

  3. Re: copy files with -- names

    Merlin Morgenstern wrote:
    > Hi there,
    >
    > unfortunatelly I do have file names that start with -- which obviously
    > creates a problem:
    >
    > cp --germany--bayern--id\=40001.jpg /home/user/
    >
    > does not work as cp believes that there is a command following the --
    >
    > I tried to escape it with \ or " or ' but nothing worked :-(
    >
    > Any ideas?


    cp -- --g[tab]
    or better
    mv -- --g[tab] /home/user/subdir/germany--bayern--id40001.jpg


    houghi
    --
    Listen do you hear them drawing near in their search for the sinners?
    Feeding on the power of our fear and the evil within us.
    Incarnation of Satan's creation of all that we dread.
    When the demons arrive those alive would be better off dead!

  4. Re: copy files with -- names

    Merlin Morgenstern writes:

    >Hi there,


    >unfortunatelly I do have file names that start with -- which obviously
    >creates a problem:


    >cp --germany--bayern--id\=40001.jpg /home/user/


    >does not work as cp believes that there is a command following the --


    >I tried to escape it with \ or " or ' but nothing worked :-(


    >Any ideas?


    cp ./--germany--bayern--id\=40001.jpg /home/user/

    >Thanx, Merlin


  5. Re: copy files with -- names

    On Nov 6, 4:48 am, houghi wrote:
    > Merlin Morgenstern wrote:
    > > Hi there,

    >
    > > unfortunatelly I do have file names that start with -- which obviously
    > > creates a problem:

    >
    > > cp --germany--bayern--id\=40001.jpg /home/user/

    >
    > > does not work as cp believes that there is a command following the --

    >
    > > I tried to escape it with \ or " or ' but nothing worked :-(

    >
    > > Any ideas?

    >
    > cp -- --g[tab]
    > or better
    > mv -- --g[tab] /home/user/subdir/germany--bayern--id40001.jpg


    Better yet (because it doesn't depend on each app implementing the
    doubledash escape argument)
    cp ./--germany--bayern--id\=40001.jpg /home/user/



  6. Re: copy files with -- names

    Lew Pitcher wrote:
    >> cp -- --g[tab]
    >> or better
    >> mv -- --g[tab] /home/user/subdir/germany--bayern--id40001.jpg

    >
    > Better yet (because it doesn't depend on each app implementing the
    > doubledash escape argument)
    > cp ./--germany--bayern--id\=40001.jpg /home/user/


    Better yet is NOT to have files like that, hence my second part of the
    argument. I would not say that your solution is better then mine. It is
    just different. I use the one that is proposed for hundreds of years, so
    there must be something to it.

    houghi
    --
    >>>> Run the following from the bashprompt if you have the kernel sources

    for I in `find /usr/src/linux/ -name *.c`; \
    do A=`grep -i -A 1 -B 1 **** $I`;if [ "$A" != "" ]; \
    then printf "$I \n$A \n\n"; fi ;done|less

  7. Re: copy files with -- names

    houghi writes:

    >Lew Pitcher wrote:
    >>> cp -- --g[tab]
    >>> or better
    >>> mv -- --g[tab] /home/user/subdir/germany--bayern--id40001.jpg

    >>
    >> Better yet (because it doesn't depend on each app implementing the
    >> doubledash escape argument)
    >> cp ./--germany--bayern--id\=40001.jpg /home/user/


    >Better yet is NOT to have files like that, hence my second part of the
    >argument. I would not say that your solution is better then mine. It is
    >just different. I use the one that is proposed for hundreds of years, so
    >there must be something to it.


    This is rediculous. Computers have not been around for hundreds of years,
    and the decision of the gnu people to put the -- option into SOME ( not
    nearly all) commands is at most 20 years old. And the ./ option works
    always, even if the program does not have the -- option.
    And the ./ IS better. It works in a wider variety of situations.
    I agree that starting a filename with - is dumb, as is starting a filename
    with / in Windows.


    >houghi
    >--
    >>>>> Run the following from the bashprompt if you have the kernel sources

    >for I in `find /usr/src/linux/ -name *.c`; \
    >do A=`grep -i -A 1 -B 1 **** $I`;if [ "$A" != "" ]; \
    >then printf "$I \n$A \n\n"; fi ;done|less


  8. Re: copy files with -- names

    Unruh wrote:
    >>Better yet is NOT to have files like that, hence my second part of the
    >>argument. I would not say that your solution is better then mine. It is
    >>just different. I use the one that is proposed for hundreds of years, so
    >>there must be something to it.

    >
    > This is rediculous. Computers have not been around for hundreds of years,


    I stand corrected, it should have been thousands of years. Sorry.

    houghi
    --
    ________________________ Open your eyes, open your mind
    | proud like a god don't pretend to be blind
    | trapped in yourself, break out instead
    http://openSUSE.org | beat the machine that works in your head

  9. Re: copy files with -- names

    On Thu, 08 Nov 2007 12:24:49 +0100, houghi wrote:

    > Unruh wrote:
    >>>Better yet is NOT to have files like that, hence my second part of the
    >>>argument. I would not say that your solution is better then mine. It is
    >>>just different. I use the one that is proposed for hundreds of years, so
    >>>there must be something to it.

    >>
    >> This is rediculous. Computers have not been around for hundreds of years,

    >
    > I stand corrected, it should have been thousands of years. Sorry.


    Computers have been around for over a thousand years, but for most of that
    time they were people rather than machines.

+ Reply to Thread