PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Verfügt »cp« über eine Prozentanzeige?



ichunddu
31.01.05, 16:46
Hallo,
verfügt das Kopierprogramm »cp« über eine Prozent- oder ähnliche Fortschrittsanzeige?

fl4kus
31.01.05, 16:49
in der man page steht nix dazu. vllt reicht dir aber auch --verbose. das zeigt dir an was gerade gemacht wird

darkmind
31.01.05, 17:01
ja gibt es! siehe angehängten screenshot

cp -g source target

ich hab mir gleich ein alias dafür erstellt

fehl-x
31.01.05, 17:06
hi,
so weit ich weiss, gibt es keine prozentanzeige. du könntest aber quell- und zielverzeichnis mittels
bash# du -h /das/verzeichnismiteiander vergleichen.
'du -h' gibt die grösse eines verzeichnisses 'human readable' (als MB/GB/TB) an.
um an einen prozentwert zu kommen, könnte man sich ein kleinens bashskriptscheiben, das die grösse des quellverzeichnisses durch die grösse des zielverzeichnisses teilt und dann mit durch 100 dividiert.

felix

ps. bei der formel für den prozentwert bin ich mir gerade nicht 100%-tig ;-) sicher, aber das kann man ja ausprobieren bzw. nachgucken.


edit: ...scheint es wohl doch zu geben.

CEROG
31.01.05, 17:06
Hallo zusammen,

leider funktioniert die Option "-g" nicht überall.

Vermutlich hast du eine gepatchte Version von "cp".

Viele Grüße,

CEROG

ichunddu
31.01.05, 17:09
Ja, bei mir (Slack 10) funzt es nicht. Und ich suche eben eine Option, damit ich nicht immer mit ls oder du hantieren muss :p

darkmind
31.01.05, 17:12
Vermutlich hast du eine gepatchte Version von "cp".


[bernhard@gen2box] [~]
% cp --version [18:10]
cp (coreutils) 5.2.1
Written by Torbjorn Granlund, David MacKenzie, and Jim Meyering.

Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


// EDIT: das file muß eine bestimmte größe überschreiten. bei kleinen files wird der fortschrittsbalken auch nicht angezeigt! (hätte ja auch keinen sinn)

unununium
31.01.05, 18:29
Das hat auch mit der Größe nichts zu tun, habe es grade mit einem 242MB File getestet (PlaneShift), und -g ist einfach eine ungültige Option. Also gibt es beim "normalen" cp wohl doch keine Funktion dafür, schade. :-(

ZoRn
31.01.05, 18:42
Hallo,
ich habe schon von mehreren Gentoolern von der cp -g Option gehoert, konnte aber noch
keinen Patch auftreiben. Vllt. hatte ja einer hier aus dem Forum mehr Erfolg...
Danke,

Malte

stefan-tiger
31.01.05, 18:49
bash-2.05b$ cp --help | grep -i "\-g"
-g, --progress show a progress bar if operation is going to

SierraXTC
31.01.05, 19:02
Also die fileutils (zumindest cp und mv) unter Gentoo sind scheinbar gepatcht. Dort kann man sich mit dem Schalter -g für große Dateien den Fortschritt anzeigen lassen.

Ansonsten konnte ich mich noch IMHO an ein Projekt hier im Forum entsinnen. Evtl hilft dieser Link noch weiter:
http://www.aichler.net/fileutils/index.html

Greetz
SierraXTC

schnabeltasse
31.01.05, 19:03
tho@inri:~$ cp --help | grep -i "\-g"
tho@inri:~$ cp --version
cp (coreutils) 5.2.1
Geschrieben von Torbjorn Granlund, David MacKenzie und Jim Meyering.

Copyright (C) 2004 Free Software Foundation, Inc.
Dies ist freie Software; die Kopierbedingungen stehen in den Quelltexten. Es
gibt keine Garantie; auch nicht für VERKAUFBARKEIT oder FÜR SPEZIELLE ZWECKE.
tho@inri:~$
ich habe die selbe version, aber kein "-g"

kshade
31.01.05, 19:16
Ist ein Patch, gibts hier (http://ihme.org/~miipekk/pbar_coreutils.diff)

lordsen
31.01.05, 19:18
Hier ist der Patch für die 5.2.1 Version der Coreutils drin:

http://gentoo.osuosl.org/distfiles/coreutils-5.2.1-gentoo-0.6.tar.bz2

/patch/generic/001_all_coreutils-gen-progress-bar.patch

Viel Spass

Falls ihr den Source der Coreutils noch braucht:
http://gentoo.osuosl.org/distfiles/coreutils-5.2.1.tar.bz2

Edit: Zu spät.

ichunddu
31.01.05, 19:28
Danke, ihr seid die besten ;)

kshade
31.01.05, 19:33
Edit: Zu spät.Ist das denn der selbe?

lordsen
31.01.05, 19:47
Ich habs mal überflogen... Bis auf minimale Unterschiede, im Großen und Ganzen: Ja.

Gentoo Patch:
diff -urN coreutils-5.2.0.orig/src/copy.c coreutils-5.2.0/src/copy.c
--- coreutils-5.2.0.orig/src/copy.c 2004-02-07 07:42:04.000000000 -0800
+++ coreutils-5.2.0/src/copy.c 2004-02-21 14:37:38.000000000 -0800
@@ -17,6 +17,8 @@

/* Extracted from cp.c and librarified by Jim Meyering. */

+/* Progress bar support added by Miika Pekkarinen. miipekk@ihme.org */
+
#include <config.h>
#include <stdio.h>
#include <assert.h>
@@ -26,6 +28,10 @@
# include <hurd.h>
#endif
(...)

Dein Patch:
diff -u -3 -p -u -r1.149 copy.c
--- src/copy.c 9 Aug 2003 17:48:41 -0000 1.149
+++ src/copy.c 24 Aug 2003 09:16:11 -0000
@@ -17,6 +17,8 @@

/* Extracted from cp.c and librarified by Jim Meyering. */

+/* Progress bar support added by Miika Pekkarinen. */
+
#include <config.h>
#include <stdio.h>
#include <assert.h>
@@ -26,6 +28,10 @@
# include <hurd.h>
#endif
(...)

delmonico
31.01.05, 19:52
# include <hurd.h>

WTF? o_O

lordsen
31.01.05, 19:59
Naja die GNU/coreutils haben halt Hurd Support :D

[lordsen@mynet] ~/c/patch/generic/cc/coreutils-5.2.1 30 files (2.0M) % grep -r -i hurd *
NEWS:* New ls option: --author (for the Hurd).
NEWS:* remove portability limitations (e.g., PATH_MAX on the Hurd, fixes for
config.hin:/* Define to 1 if you have the <hurd.h> header file. */
config.hin:#undef HAVE_HURD_H
configure: hurd.h \
configure: /* The Hurd doesn't define this, so getcwd can't exhibit the bug --
doc/coreutils.texi:@cindex hurd, author, printing
doc/coreutils.texi:In GNU/Hurd, file authors can differ from their owners, but in other
doc/coreutils.info: listings. In GNU/Hurd, file authors can differ from their owners,
doc/coreutils.info:* hurd, author, printing: What information is listed.
lib/getloadavg.c:/* Same issues as for NeXT apply to the HURD-based GNU system. */
m4/getcwd-path-max.m4: /* The Hurd doesn't define this, so getcwd can't exhibit the bug --
m4/jm-macros.m4: hurd.h \
m4/lstat.m4:dnl zero-length file name argument. The lstat from SunOS 4.1.4 and the Hurd
m4/stat.m4:dnl zero-length file name argument. The stat from SunOS 4.1.4 and the Hurd
m4/ChangeLog: Otherwise, on the Hurd, it would take a long time to create
m4/ChangeLog: * jm-macros.m4 (jm_CHECK_ALL_HEADERS): Check for hurd.h.
m4/ChangeLog: cross-compiling for the Hurd.
old/fileutils/ChangeLog: * src/copy.c Include hurd.h.
old/fileutils/ChangeLog: Add support for new ls option --author, for GNU/Hurd.
old/fileutils/ChangeLog: Accommodate the Hurd (defining lstat to rpl_lstat via config.h didn't
old/fileutils/ChangeLog: work on Hurd systems because of an inline definition of lstat in a
old/fileutils/ChangeLog: `rm -r ''' got a failed assertion on the Hurd. This change
old/fileutils/ChangeLog-1997: The Hurd and Linux will have it.
old/fileutils/NEWS:* New ls option: --author (for the Hurd).
old/fileutils/NEWS:* remove portability limitations (e.g., PATH_MAX on the Hurd, fixes for
old/fileutils/NEWS:* rm -rf '' no longer gets a failed assertion on the Hurd
src/fs.h:# include <hurd/hurd_types.h>
src/copy.c:#if HAVE_HURD_H

ichunddu
31.01.05, 20:04
hurd? mir doch egal

ichunddu@zimmer:/downloads$ cp --help|grep -i "\-g"
-g, --progress show a progress bar if operation is going to
:D