Aller au contenu
  • 0

Commande Trouver Et Déplacer En ssh


davelboss

Question

Bonjour,

Voici le problème que je rencontre:

Je possède un QNAP119 sur lequel est connecté un disque USB externe qui stoque toute ma musique dans divers sous dossiers. Mon objectif est de supprimer cette arborescence et de mettre l'ensemble des mp3 à la racine du disque.

Plusieurs possibilités:

Depuis le webfilemanager:

problème: l'aborescence est trop importante, et la recherche n'affiche que 100 résultats par page. De plus, le soft bug lorsque j'essaie de déplacer vers la racine. Il ne se passe rien.

FTP:

Problème:Impossible de faire de recherche dans l'aborescence.

Seul moyen trouvé, une connexion en

Voici la commande tapée:

# find -iname *.mp3 -exec mv {} /mp3 \;

Problème, la commande find fonctionne mais pas le déplacement?

Quel est la commande pour trouver des fichiers dans une arborescence puis les déplacer??

Merci pour votre aide.

David

Lien vers le commentaire
Partager sur d’autres sites

9 réponses à cette question

Messages recommandés

  • 0

la commande find du nas est très simpliste,

[~] # find --help

BusyBox v1.01 (2011.11.11-17:19+0000) multi-call binary

Usage: find [PATH...] [EXPRESSION]

Search for files in a directory hierarchy. The default PATH is

the current directory; default EXPRESSION is '-print'

EXPRESSION may consist of:

-follow Dereference symbolic links.

-name PATTERN File name (leading directories removed) matches PATTERN.

-print Print (default and assumed).

-type X Filetype matches X (where X is one of: f,d,l,b,c,...)

-perm PERMS Permissions match any of (+NNN); all of (-NNN);

or exactly (NNN)

-mtime TIME Modified time is greater than (+N); less than (-N);

or exactly (N) days

le seul moyen est d'utiliser un

mv *.mp3 /share/Multimedia/musique par exemple ou créer un fichier bash pour traiter en masse dans des répertoires multiples.

cris

Lien vers le commentaire
Partager sur d’autres sites

  • 0

Merci,

La commande citée fonctionne bien mais ne prend pas en charge les sous dossiers. Existe t-il une solution simple qui permettrait de combiner la commande find et la commande mv.

Je ne sais pas comment réaliser un bash. Je rappelle mon besoin:

Trouver et déplacer en masse des fichiers dans une sous arborescence telle que pourrait le faire la commande suivante qui malheureseuesment ne fonctionne pas.

find *.mp3 -exec mv {} /share/Multimedia/musique \; (pourquoi ça marche pas???

Merci de votre aide.

David

Lien vers le commentaire
Partager sur d’autres sites

  • 0

Bonjour,

Essayer avec le find complet ... (Optware ipkg)


[~] # /opt/bin/find --help

Usage: /opt/bin/find [path...] [expression]

default path is the current directory; default expression is -print

expression may consist of: operators, options, tests, and actions:

operators (decreasing precedence; -and is implicit where no others are given):

	  ( EXPR )   ! EXPR   -not EXPR   EXPR1 -a EXPR2   EXPR1 -and EXPR2

	  EXPR1 -o EXPR2   EXPR1 -or EXPR2   EXPR1 , EXPR2

positional options (always true): -daystart -follow -regextype

normal options (always true, specified before other expressions):

	  -depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf

	  --version -xdev -ignore_readdir_race -noignore_readdir_race

tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N

	  -cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME

	  -ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN

	  -links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE

	  -nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN

	  -wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N

	  -used N -user NAME -xtype [bcdpfls]

actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print

	  -fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit

	  -exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;

	  -execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;

Report (and track progress on fixing) bugs via the findutils bug-reporting

page at http://savannah.gnu.org/ or, if you have no web access, by sending

email to <bug-findutils@gnu.org>.

[~] #

idem pour le mv

[~] # /opt/bin/mv --help

Usage: /opt/bin/mv [OPTION]... [-T] SOURCE DEST

  or:  /opt/bin/mv [OPTION]... SOURCE... DIRECTORY

  or:  /opt/bin/mv [OPTION]... -t DIRECTORY SOURCE...

Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.

	  --backup[=CONTROL]	   make a backup of each existing destination file

  -b						   like --backup but does not accept an argument

  -f, --force				  do not prompt before overwriting

  -i, --interactive		    prompt before overwrite

  -n, --no-clobber			 do not overwrite an existing file

If you specify more than one of -i, -f, -n, only the final one takes effect.

	  --strip-trailing-slashes  remove any trailing slashes from each SOURCE

								 argument

  -S, --suffix=SUFFIX		  override the usual backup suffix

  -t, --target-directory=DIRECTORY  move all SOURCE arguments into DIRECTORY

  -T, --no-target-directory    treat DEST as a normal file

  -u, --update				 move 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

	  --help	 display this help and exit

	  --version  output version information and exit

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

Report mv 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/>

For complete documentation, run: info coreutils 'mv invocation'

Philippe.

Lien vers le commentaire
Partager sur d’autres sites

  • 0

Bonjour,

Essayer avec le find complet ... (Optware ipkg)


[~] # /opt/bin/find --help
Usage: /opt/bin/find [path...] [expression]
default path is the current directory; default expression is -print
expression may consist of: operators, options, tests, and actions:
operators (decreasing precedence; -and is implicit where no others are given):
( EXPR ) ! EXPR -not EXPR EXPR1 -a EXPR2 EXPR1 -and EXPR2
EXPR1 -o EXPR2 EXPR1 -or EXPR2 EXPR1 , EXPR2
positional options (always true): -daystart -follow -regextype
normal options (always true, specified before other expressions):
-depth --help -maxdepth LEVELS -mindepth LEVELS -mount -noleaf
--version -xdev -ignore_readdir_race -noignore_readdir_race
tests (N can be +N or -N or N): -amin N -anewer FILE -atime N -cmin N
-cnewer FILE -ctime N -empty -false -fstype TYPE -gid N -group NAME
-ilname PATTERN -iname PATTERN -inum N -iwholename PATTERN -iregex PATTERN
-links N -lname PATTERN -mmin N -mtime N -name PATTERN -newer FILE
-nouser -nogroup -path PATTERN -perm [+-]MODE -regex PATTERN
-wholename PATTERN -size N[bcwkMG] -true -type [bcdpflsD] -uid N
-used N -user NAME -xtype [bcdpfls]
actions: -delete -print0 -printf FORMAT -fprintf FILE FORMAT -print
-fprint0 FILE -fprint FILE -ls -fls FILE -prune -quit
-exec COMMAND ; -exec COMMAND {} + -ok COMMAND ;
-execdir COMMAND ; -execdir COMMAND {} + -okdir COMMAND ;
Report (and track progress on fixing) bugs via the findutils bug-reporting
page at http://savannah.gnu.org/ or, if you have no web access, by sending
email to <bug-findutils@gnu.org>.
[~] #
[/CODE] idem pour le mv
[CODE]
[~] # /opt/bin/mv --help
Usage: /opt/bin/mv [OPTION]... [-T] SOURCE DEST
or: /opt/bin/mv [OPTION]... SOURCE... DIRECTORY
or: /opt/bin/mv [OPTION]... -t DIRECTORY SOURCE...
Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.
Mandatory arguments to long options are mandatory for short options too.
--backup[=CONTROL] make a backup of each existing destination file
-b like --backup but does not accept an argument
-f, --force do not prompt before overwriting
-i, --interactive prompt before overwrite
-n, --no-clobber do not overwrite an existing file
If you specify more than one of -i, -f, -n, only the final one takes effect.
--strip-trailing-slashes remove any trailing slashes from each SOURCE
argument
-S, --suffix=SUFFIX override the usual backup suffix
-t, --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY
-T, --no-target-directory treat DEST as a normal file
-u, --update move 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
--help display this help and exit
--version output version information and exit
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
Report mv 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/>
For complete documentation, run: info coreutils 'mv invocation'

Philippe.

avant:

ipkg install findutils

et

ipkg install coreutils

Lien vers le commentaire
Partager sur d’autres sites

  • 0

Ok j'ai bien installé les packets IPKG en question. Cependant, comment se fait il qu'il existe un différence lorsque je saisi la commande suivante lorsque je suis dans:

~] # mv --help

BusyBox v1.01 (2011.11.11-20:46+0000) multi-call binary

Usage: mv [OPTION]... SOURCE DEST

or: mv [OPTION]... SOURCE... DIRECTORY

Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

Options:

-f don't prompt before overwriting

-i interactive, prompt before overwrite

Et lorsque je suis dans /opt/bin/

~] # /opt/bin/mv --help

Usage: /opt/bin/mv [OPTION]... [-T] SOURCE DEST

or: /opt/bin/mv [OPTION]... SOURCE... DIRECTORY

or: /opt/bin/mv [OPTION]... -t DIRECTORY SOURCE...

Rename SOURCE to DEST, or move SOURCE(s) to DIRECTORY.

Mandatory arguments to long options are mandatory for short options too.

--backup[=CONTROL] make a backup of each existing destination file

-b like --backup but does not accept an argument

-f, --force do not prompt before overwriting

-i, --interactive prompt before overwrite

-n, --no-clobber do not overwrite an existing file

If you specify more than one of -i, -f, -n, only the final one takes effect.

--strip-trailing-slashes remove any trailing slashes from each SOURCE

argument

-S, --suffix=SUFFIX override the usual backup suffix

-t, --target-directory=DIRECTORY move all SOURCE arguments into DIRECTORY

-T, --no-target-directory treat DEST as a normal file

-u, --update move 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

--help display this help and exit

--version output version information and exit

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

Report mv 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/>

For complete documentation, run: info coreutils 'mv invocation'

[~] #

Le wiki qnap n'en parle pas... dois je lancer la commande depuis ce dossier pour avoir l'ensemble des fonctionnalités? puis je par défaut utiliser les commandes complète sans avoir à passer par ce dossier??

Je ne trouve pas l'info sur le net et n'ayant pas une culture linuxiène développée votre aide serait appréciée pour assouvir ma curiosité :)

Merci d'avance

Modifié par davelboss
Lien vers le commentaire
Partager sur d’autres sites

  • 0

Bonjour,

En résumé, les Linux (embarqués) sont allégés car doivent "rentrer" en mémoire flash limitée ... puis transféré en mémoire vive (pour permettre entre autre la mise en sommeil des disques)

Pour ce faire elle utilise un "couteau suisse" qui est Busybox, un seul programme pour n programmes autonomes habituellement, bien sur si busybox est plus "léger" c'est qu'il communalise des fonctions utiles pour tous les indépendants et qu'il propose une version minimum incomplète mais suffisante en usage basique des commandes indépendantes ...

Ipkg ... lui propose les versions complètes de chaque utilitaire ...

le mv inclus ... pointe sur le module mv intégré à busybox

le mv ipkg ... est la version complète de mv ...

Si vous entrez mv (tout court) ... ce sera le premier trouvé dans le PATH (chemin de recherche des exécutables faites un echo $PATH pour le voir)

celui en interne est dans /bin ... donc c'est celui-ci qui est lancé ...

Le mieux est TOUJOURS d'utiliser le chemin complet (dans ce cas pas d'usage de PATH )

/bin/mv ... sera celui inclus

//opt/bin/mv ... sera le complet ...

la syntaxe "chemin complet vers l’exécutable" fonctionne, et va vers le bon exécutable, quelque soit l'endroit (répertoire) ou vous vous trouvez ...

Philippe.

Lien vers le commentaire
Partager sur d’autres sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Invité
Répondre à cette question…

×   Vous avez collé du contenu avec mise en forme.   Supprimer la mise en forme

  Seulement 75 émoticônes maximum sont autorisées.

×   Votre lien a été automatiquement intégré.   Afficher plutôt comme un lien

×   Votre contenu précédent a été rétabli.   Vider l’éditeur

×   Vous ne pouvez pas directement coller des images. Envoyez-les depuis votre ordinateur ou insérez-les depuis une URL.

Chargement
×
×
  • Créer...