Parameter für "cp" Befehl

Status
Für weitere Antworten geschlossen.

unimatrix0

Benutzer
Mitglied seit
17. Aug 2009
Beiträge
34
Punkte für Reaktionen
0
Punkte
0
Hallo zusammen,

woher bekomme ich die möglichen Parameter für den cp Befehl auf der Commandozeile?

Ich kenne den Parameter prinzipiell, aber es funktionieren wohl nicht alle!??!
( http://unixhelp.ed.ac.uk/CGI/man-cgi?cp )

Speziell bräuchte ich den -u (kopiere nur neuere Dateien). Aber dieser funktioniert nicht und wird mit "cp: invalid option -- u" quitiert.

Hat hier einer einen Tipp??

Gruß Robert
 

Matthieu

Benutzer
Mitglied seit
03. Nov 2008
Beiträge
13.222
Punkte für Reaktionen
88
Punkte
344
Die Hilfe lässt sich unterschiedlich aufrufen. Probier mal folgende:
cp -h
cp -help
cp -?

Oder installiert dir die man-Seiten (über ipkg). Das sind dann die vollen Anleitungen wie du sie auch im Netz gefunden hast zu jedem Befehl.

Wenn die Fehlermeldung so genau abgeschrieben wurde, dann ist da ein Leerzeichen zwischen -- und u. Probier es auch mal nur mit einem Strich (anstatt --).

MfG Matthieu
 

itari

Benutzer
Mitglied seit
15. Mai 2008
Beiträge
21.900
Punkte für Reaktionen
14
Punkte
0
Die Unix/Linux-Kommandos sind ja nicht wirklich genormt. Es gibt zwar dazu einen Standard namens POSIX.2 (*guck*), aber oft wird der über erfüllt oder eben manchmal auch nicht. Die erste Suche wäre also immer nach einer 'vollständigen' Optionsbeschreibung, z.B. hier. Nun zeigt das Linux auf der DS an, dass das nicht geht und zugleich wird auch ausgegeben warum nicht:

Rich (BBCode):
BusyBox v1.1.0 (2010.01.27-14:24+0000) multi-call binary

Die Webseite der BusyBox erklärt, warum man kein komplettes Abbild aller Kommandos mit allen Optionen haben möchte (klein und fein) und man sieht im BusyBox-Manual schon, dass sich die Optionen auf ein paar wenige zusammengestrichen haben: *guck*.

Es kann sogar sein, da man die BusyBox ja konfektionieren kann, dass in der tatsächliche Implementation noch weniger, aber auch manchmal mehr Optionen vorhanden sind. Das ist völlig normal und für alle Unix/Linux-Leute auch nichts außergewöhnliches.

Wenn man nun spezielle Optionen unbedingt braucht, dann besteht die Möglichkeit, weitere Fassungen des Kommandos per IPKG dazu zu installieren. Klar muss man dann das Kommando mit komplettem Pfad aufrufen, aber dann sieht man schon, dass die Optionen möglich sind:

Rich (BBCode):
Synology> /opt/bin/coreutils-cp --help
Usage: /opt/bin/coreutils-cp [OPTION]... [-T] SOURCE DEST
  or:  /opt/bin/coreutils-cp [OPTION]... SOURCE... DIRECTORY
  or:  /opt/bin/coreutils-cp [OPTION]... -t DIRECTORY SOURCE...
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.
  -a, --archive                same as -dR --preserve=all
      --backup[=CONTROL]       make a backup of each existing destination file
  -b                           like --backup but does not accept an argument
      --copy-contents          copy contents of special files when recursive
  -d                           same as --no-dereference --preserve=links
  -f, --force                  if an existing destination file cannot be
                                 opened, remove it and try again (redundant if
                                 the -n option is used)
  -i, --interactive            prompt before overwrite (overrides a previous -
                                  option)
  -H                           follow command-line symbolic links in SOURCE
  -l, --link                   link files instead of copying
  -L, --dereference            always follow symbolic links in SOURCE
  -n, --no-clobber             do not overwrite an existing file (overrides
                                 a previous -i option)
  -P, --no-dereference         never follow symbolic links in SOURCE
  -p                           same as --preserve=mode,ownership,timestamps
      --preserve[=ATTR_LIST]   preserve the specified attributes (default:
                                 mode,ownership,timestamps), if possible
                                 additional attributes: context, links, xattr,
                                 all
      --no-preserve=ATTR_LIST  don't preserve the specified attributes
      --parents                use full source file name under DIRECTORY
  -R, -r, --recursive          copy directories recursively
      --remove-destination     remove each existing destination file before
                                 attempting to open it (contrast with --force)
      --sparse=WHEN            control creation of sparse files
      --strip-trailing-slashes  remove any trailing slashes from each SOURCE
                                 argument
  -s, --symbolic-link          make symbolic links instead of copying
  -S, --suffix=SUFFIX          override the usual backup suffix
  -t, --target-directory=DIRECTORY  copy all SOURCE arguments into DIRECTORY
  -T, --no-target-directory    treat DEST as a normal file
  -u, --update                 copy only when the SOURCE file is newer
                                 than the destination file or when the
                                 destination file is missing
  -v, --verbose                explain what is being done
  -x, --one-file-system        stay on this file system
      --help     display this help and exit
      --version  output version information and exit

By default, sparse SOURCE files are detected by a crude heuristic and the
corresponding DEST file is made sparse as well.  That is the behavior
selected by --sparse=auto.  Specify --sparse=always to create a sparse DEST
file whenever the SOURCE file contains a long enough sequence of zero bytes.
Use --sparse=never to inhibit creation of sparse files.

The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control method may be selected via the --backup option or through
the VERSION_CONTROL environment variable.  Here are the values:

  none, off       never make backups (even if --backup is given)
  numbered, t     make numbered backups
  existing, nil   numbered if numbered backups exist, simple otherwise
  simple, never   always make simple backups

As a special case, cp makes a backup of SOURCE when the force and backup
options are given and SOURCE and DEST are the same name for an existing,
regular file.

Report coreutils-cp bugs to bug-coreutils@gnu.org
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>

Und wie man sieht, da wäre dann auch die Option -u dabei.

Itari
 
Zuletzt bearbeitet:

unimatrix0

Benutzer
Mitglied seit
17. Aug 2009
Beiträge
34
Punkte für Reaktionen
0
Punkte
0
DANKE! für die ausführliche Information!!!
Damit komme ich klar.

Gruß Robert
 
Status
Für weitere Antworten geschlossen.
 

Kaffeautomat

Wenn du das Forum hilfreich findest oder uns unterstützen möchtest, dann gib uns doch einfach einen Kaffee aus.

Als Dankeschön schalten wir deinen Account werbefrei.

:coffee:

Hier gehts zum Kaffeeautomat