#1 Le 22/12/2012, à 17:20
- MikeBZH44
Commande Find ne marche pas comme attendue
Bonjour.
Je tourne sur un Ubuntu 12.10 32 bits et j'essaie de faire un find dans une arborescence de fichier pour trouver tous les fichiers .xml
Je me mets donc à la racine de mon répertoire et je tape :
> find . -name .xml
La commande ne me retourne que le fichier contenu dans le répertoire courant mais pas dans les sous-répertoires :
mikael@HP-G72-Notebook-PC:~/Téléchargements/Aeon-Nox-master$ find . -name *.xml
./addon.xml
pourtant, dans le sous-répertoire 1080i, j'ai plein de fichiers .xml :
mikael@HP-G72-Notebook-PC:~/Téléchargements/Aeon-Nox-master/1080i$ ls *.xml|wc -l
187
donc pourquoi le find ne me retourne pas tous les .xml en faisant une recherche récursive ?
De plus, si je descends dans le répertoire 1080i, et que je relance la commande find, j'ai un message d'erreur bizarre :
mikael@HP-G72-Notebook-PC:~/Téléchargements/Aeon-Nox-master/1080i$ find . -name *.xml
find: les chemins doivent précéder l'expression : custom_1112_Artistinfo.xml
Utilisation : find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [chemin...] [expression]
J'ai essayé avec ./ mais c'est pareil :
mikael@HP-G72-Notebook-PC:~/Téléchargements/Aeon-Nox-master/1080i$ find ./ -name *.xml
find: les chemins doivent précéder l'expression : custom_1112_Artistinfo.xml
Utilisation : find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [chemin...] [expression]
Même en mettant le chemin complet, ça marche pas
mikael@HP-G72-Notebook-PC:~/Téléchargements/Aeon-Nox-master/1080i$ find /home/mikael/Téléchargements/Aeon-Nox-master/1080i -name *.xml
find: les chemins doivent précéder l'expression : custom_1112_Artistinfo.xml
Utilisation : find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [chemin...] [expression]
Si vous voulez tester, l'archive est la suivante : https://github.com/BigNoid/Aeon-Nox/archive/master.zip
Merci.
Hors ligne
#2 Le 22/12/2012, à 17:54
- pingouinux
Re : Commande Find ne marche pas comme attendue
Bonjour,
Il faut écrire la commande comme ceci :
find . -name \*.xml
ou
find . -name "*.xml"
Hors ligne
#3 Le 22/12/2012, à 17:56
- Maisondouf
Re : Commande Find ne marche pas comme attendue
find *.xml
ça donne quoi ?
ASUS M5A88-v EVO avec AMD FX(tm)-8120 Eight-Core Processor, OS principal Precise 12.04.1 LTS 63bits½
Bricoleur, menteur, inculte, inadapté social et mythomane, enfin d'après certains....
"the secret of my form is summed up in two words, no sport" (Winston Churchill)
Hors ligne
#4 Le 22/12/2012, à 18:06
- Maisondouf
Re : Commande Find ne marche pas comme attendue
Si c'est ça, utilise 'locate'.
Dernière modification par Maisondouf (Le 22/12/2012, à 18:07)
ASUS M5A88-v EVO avec AMD FX(tm)-8120 Eight-Core Processor, OS principal Precise 12.04.1 LTS 63bits½
Bricoleur, menteur, inculte, inadapté social et mythomane, enfin d'après certains....
"the secret of my form is summed up in two words, no sport" (Winston Churchill)
Hors ligne
#5 Le 22/12/2012, à 18:07
- pingouinux
Re : Commande Find ne marche pas comme attendue
@Maisondouf #3 :
Si, dans le répertoire d'où tu lances la commande, un fichier correspond à *.xml, l'expansion va se faire, et la commande réellement exécutée sera (par exemple) :
find toto.xml
Hors ligne
#6 Le 22/12/2012, à 18:09
- Maisondouf
Re : Commande Find ne marche pas comme attendue
Je pensais que l'action par défaut de find c'était 'print'...
En tout cas , merci pour la syntaxe, je me suis souvent battu avec find et .... j'ai toujours perdu.
Ça sous-entend (et c'est logique) que derrière -name on donne une 'pattern' donc une chaine de caractères.
Et donc l'étoile '*' doit être 'escapé' !
Le man de find devrait être revu....
Dernière modification par Maisondouf (Le 22/12/2012, à 18:15)
ASUS M5A88-v EVO avec AMD FX(tm)-8120 Eight-Core Processor, OS principal Precise 12.04.1 LTS 63bits½
Bricoleur, menteur, inculte, inadapté social et mythomane, enfin d'après certains....
"the secret of my form is summed up in two words, no sport" (Winston Churchill)
Hors ligne
#7 Le 22/12/2012, à 18:12
- ljere
Re : Commande Find ne marche pas comme attendue
j'ai testé sur mes dossier cela fonctionne sans aucun souci
j'ai donc télécharger ton dossier et la incroyable
find . -name *.xml
./Aeon-Nox-master/colors/defaults.xml
./Aeon-Nox-master/colors/White.xml
./Aeon-Nox-master/sounds/sounds.xml
./Aeon-Nox-master/1080i/SettingsSystemInfo.xml
./Aeon-Nox-master/1080i/custom_1141_Fakewindow.xml
./Aeon-Nox-master/1080i/Viewtype_Shift.xml
./Aeon-Nox-master/1080i/custom_1118_VideoOSD.xml
./Aeon-Nox-master/1080i/DialogKaiToast.xml
./Aeon-Nox-master/1080i/DialogPVRGuideInfo.xml
./Aeon-Nox-master/1080i/Home.xml
./Aeon-Nox-master/1080i/custom_1116_BreadcrumbsSetup.xml
./Aeon-Nox-master/1080i/Includes_Breadcrumbs.xml
./Aeon-Nox-master/1080i/SettingsScreenCalibration.xml
./Aeon-Nox-master/1080i/DialogKeyboard.xml
./Aeon-Nox-master/1080i/custom_1126_ViewtypeSettings.xml
./Aeon-Nox-master/1080i/script.pseudotv.AdvancedConfig.xml
./Aeon-Nox-master/1080i/SkinSettings.xml
./Aeon-Nox-master/1080i/MyPrograms.xml
./Aeon-Nox-master/1080i/custom_1134_BackgroundChooser.xml
./Aeon-Nox-master/1080i/custom_1125_DialogVideoPlaylists.xml
./Aeon-Nox-master/1080i/DialogMediaSource.xml
./Aeon-Nox-master/1080i/custom_1145_IconSelection.xml
./Aeon-Nox-master/1080i/MyMusicSongs.xml
./Aeon-Nox-master/1080i/Includes_MediaMenu.xml
./Aeon-Nox-master/1080i/MusicKaraokeLyrics.xml
./Aeon-Nox-master/1080i/Includes_MediaFlags.xml
./Aeon-Nox-master/1080i/Includes_Visualization.xml
./Aeon-Nox-master/1080i/DialogVideoInfo.xml
./Aeon-Nox-master/1080i/custom_1138_ColorPicker.xml
./Aeon-Nox-master/1080i/DialogPictureInfo.xml
./Aeon-Nox-master/1080i/VideoOSDSettings.xml
./Aeon-Nox-master/1080i/script-Actors-DialogInfo.xml
./Aeon-Nox-master/1080i/includes.xml
./Aeon-Nox-master/1080i/custom_1129_VolumeOverlay.xml
./Aeon-Nox-master/1080i/custom_1121_MediaMenu.xml
./Aeon-Nox-master/1080i/script-globalsearch-infodialog.xml
./Aeon-Nox-master/1080i/DialogKaraokeSongSelector.xml
./Aeon-Nox-master/1080i/custom_1120_NowPlaying.xml
./Aeon-Nox-master/1080i/DialogSongInfo.xml
./Aeon-Nox-master/1080i/custom_1150_SubMenuChooser.xml
./Aeon-Nox-master/1080i/MyVideoPlaylist.xml
./Aeon-Nox-master/1080i/Font.xml
./Aeon-Nox-master/1080i/DialogPVRTimerSettings.xml
./Aeon-Nox-master/1080i/Includes_Music.xml
./Aeon-Nox-master/1080i/script-RCB-gameinfo.xml
./Aeon-Nox-master/1080i/Includes_CustomizerWindow.xml
./Aeon-Nox-master/1080i/Custom_1161_InfoLineChooser.xml
./Aeon-Nox-master/1080i/LoginScreen.xml
./Aeon-Nox-master/1080i/Custom_1136_SubCustomizer.xml
./Aeon-Nox-master/1080i/script.pseudotv.EPG.xml
./Aeon-Nox-master/1080i/custom_1115_Featured.xml
./Aeon-Nox-master/1080i/custom_1139_DialogHomeConcert.xml
./Aeon-Nox-master/1080i/FileBrowser.xml
./Aeon-Nox-master/1080i/Custom_1163_ArtworkPopup.xml
./Aeon-Nox-master/1080i/DialogSlider.xml
./Aeon-Nox-master/1080i/DialogFavourites.xml
./Aeon-Nox-master/1080i/Viewtype_LowList.xml
./Aeon-Nox-master/1080i/script-RSS_Editor-setEditor.xml
./Aeon-Nox-master/1080i/Startup.xml
./Aeon-Nox-master/1080i/MyVideoNav.xml
./Aeon-Nox-master/1080i/custom_1157_QuickList.xml
./Aeon-Nox-master/1080i/MusicOSD.xml
./Aeon-Nox-master/1080i/VisualisationPresetList.xml
./Aeon-Nox-master/1080i/LockSettings.xml
./Aeon-Nox-master/1080i/script-MovieSets-DialogInfo.xml
./Aeon-Nox-master/1080i/SettingsProfile.xml
./Aeon-Nox-master/1080i/custom_1147_Featured.xml
./Aeon-Nox-master/1080i/DialogYesNo.xml
./Aeon-Nox-master/1080i/DialogAlbumInfo.xml
./Aeon-Nox-master/1080i/Viewtype_ShowcaseSquare.xml
./Aeon-Nox-master/1080i/DialogPVRGuideOSD.xml
./Aeon-Nox-master/1080i/script.pseudotv.ChannelConfig.xml
./Aeon-Nox-master/1080i/script-RCB-contextmenu.xml
./Aeon-Nox-master/1080i/script-Actors-DialogVideoInfo.xml
./Aeon-Nox-master/1080i/DialogPVRGuideSearch.xml
./Aeon-Nox-master/1080i/Custom_1148_SmartPlaylistManager.xml
./Aeon-Nox-master/1080i/Includes_MainMenu.xml
./Aeon-Nox-master/1080i/custom_1117_MusicOSD.xml
./Aeon-Nox-master/1080i/MyWeather.xml
./Aeon-Nox-master/1080i/DialogFileStacking.xml
./Aeon-Nox-master/1080i/DialogContentSettings.xml
./Aeon-Nox-master/1080i/script-XBMC_Lyrics-main.xml
./Aeon-Nox-master/1080i/Includes_PVR.xml
./Aeon-Nox-master/1080i/AddonBrowser.xml
./Aeon-Nox-master/1080i/SmartPlaylistRule.xml
./Aeon-Nox-master/1080i/MyPVR.xml
./Aeon-Nox-master/1080i/MyMusicPlaylistEditor.xml
./Aeon-Nox-master/1080i/custom_1137_SelectDialog.xml
./Aeon-Nox-master/1080i/MyTVNav.xml
./Aeon-Nox-master/1080i/Viewtype_Banners.xml
./Aeon-Nox-master/1080i/Custom_1162_RSSManager.xml
./Aeon-Nox-master/1080i/MusicOverlay.xml
./Aeon-Nox-master/1080i/Viewtype_Episode.xml
./Aeon-Nox-master/1080i/ProfileSettings.xml
./Aeon-Nox-master/1080i/Viewtype_Landscape.xml
./Aeon-Nox-master/1080i/script-XBMC-Subtitles-main.xml
./Aeon-Nox-master/1080i/Custom_1133_WidgetChooser.xml
./Aeon-Nox-master/1080i/DialogGamepad.xml
./Aeon-Nox-master/1080i/script-NextAired-TVGuide.xml
./Aeon-Nox-master/1080i/custom_1160_RSSFeedSelection.xml
./Aeon-Nox-master/1080i/script-Actors-Browser.xml
./Aeon-Nox-master/1080i/MusicVisualisation.xml
./Aeon-Nox-master/1080i/custom_1142_TypeSelection.xml
./Aeon-Nox-master/1080i/Viewtype_Panel.xml
./Aeon-Nox-master/1080i/DialogPVRGroupManager.xml
./Aeon-Nox-master/1080i/custom_1156_Busy.xml
./Aeon-Nox-master/1080i/custom_1143_AreaSelection.xml
./Aeon-Nox-master/1080i/VideoOSD.xml
./Aeon-Nox-master/1080i/custom_1132_IconPanelManager.xml
./Aeon-Nox-master/1080i/custom_1151_ExchangePositions.xml
./Aeon-Nox-master/1080i/custom_1140_FeaturedDialog.xml
./Aeon-Nox-master/1080i/Includes_Viewtypes.xml
./Aeon-Nox-master/1080i/Custom_1122_ItemChooser.xml
./Aeon-Nox-master/1080i/DialogPeripheralSettings.xml
./Aeon-Nox-master/1080i/DialogPVRChannelsOSD.xml
./Aeon-Nox-master/1080i/variables.xml
./Aeon-Nox-master/1080i/custom_1131_HomeFurniture.xml
./Aeon-Nox-master/1080i/DialogNetworkSetup.xml
./Aeon-Nox-master/1080i/DialogPVRChannelManager.xml
./Aeon-Nox-master/1080i/Viewtype_LowListMusic.xml
./Aeon-Nox-master/1080i/SmartPlaylistEditor.xml
./Aeon-Nox-master/1080i/Viewtype_ShowcaseMovies.xml
./Aeon-Nox-master/1080i/DialogKaraokeSongSelectorLarge.xml
./Aeon-Nox-master/1080i/defaults.xml
./Aeon-Nox-master/1080i/VideoOSDBookmarks.xml
./Aeon-Nox-master/1080i/Settings.xml
./Aeon-Nox-master/1080i/custom_1112_Artistinfo.xml
./Aeon-Nox-master/1080i/VideoOverlay.xml
./Aeon-Nox-master/1080i/custom_1128_ColorSelect.xml
./Aeon-Nox-master/1080i/DialogPeripheralManager.xml
./Aeon-Nox-master/1080i/DialogTextViewer.xml
./Aeon-Nox-master/1080i/Viewtype_TriPanelSquare.xml
./Aeon-Nox-master/1080i/Pointer.xml
./Aeon-Nox-master/1080i/script-Rom_Collection_Browser-main.xml
./Aeon-Nox-master/1080i/Viewtype_Stripshow.xml
./Aeon-Nox-master/1080i/Includes_Widget2.xml
./Aeon-Nox-master/1080i/Viewtype_AddonWall.xml
./Aeon-Nox-master/1080i/Viewtype_Wall.xml
./Aeon-Nox-master/1080i/Includes_Widget1.xml
./Aeon-Nox-master/1080i/custom_1127_MediaBackgroundCustomizer.xml
./Aeon-Nox-master/1080i/Custom_1123.MediaMenuHelp.xml
./Aeon-Nox-master/1080i/DialogBusy.xml
./Aeon-Nox-master/1080i/DialogOK.xml
./Aeon-Nox-master/1080i/DialogSeekBar.xml
./Aeon-Nox-master/1080i/DialogButtonMenu.xml
./Aeon-Nox-master/1080i/DialogMuteBug.xml
./Aeon-Nox-master/1080i/custom_1119_InfoPanelLayout.xml
./Aeon-Nox-master/1080i/MyPics.xml
./Aeon-Nox-master/1080i/script-RSS_Editor-rssEditor.xml
./Aeon-Nox-master/1080i/script-Actors-ContextMenu.xml
./Aeon-Nox-master/1080i/FileManager.xml
./Aeon-Nox-master/1080i/script.pseudotv.TVOverlay.xml
./Aeon-Nox-master/1080i/SettingsCategory.xml
./Aeon-Nox-master/1080i/DialogExtendedProgressBar.xml
./Aeon-Nox-master/1080i/Viewtype_FullscreenPanel.xml
./Aeon-Nox-master/1080i/custom_1158_NowPlayingCustomizer.xml
./Aeon-Nox-master/1080i/PlayerControls.xml
./Aeon-Nox-master/1080i/Viewtype_List.xml
./Aeon-Nox-master/1080i/MyMusicNav.xml
./Aeon-Nox-master/1080i/DialogAddonSettings.xml
./Aeon-Nox-master/1080i/script-globalsearch-contextmenu.xml
./Aeon-Nox-master/1080i/custom_1153_WeatherWorld.xml
./Aeon-Nox-master/1080i/DialogProgress.xml
./Aeon-Nox-master/1080i/Viewtype_TriPanel.xml
./Aeon-Nox-master/1080i/DialogFullScreenInfo.xml
./Aeon-Nox-master/1080i/DialogPVRRecordingInfo.xml
./Aeon-Nox-master/1080i/custom_1144_FunctionSelection.xml
./Aeon-Nox-master/1080i/SlideShow.xml
./Aeon-Nox-master/1080i/script-globalsearch-main.xml
./Aeon-Nox-master/1080i/custom_1113_ShutdownWarning.xml
./Aeon-Nox-master/1080i/DialogAddonInfo.xml
./Aeon-Nox-master/1080i/custom_1149_PlaylistTypeSelection.xml
./Aeon-Nox-master/1080i/custom_1155_LiveBGContent.xml
./Aeon-Nox-master/1080i/DialogSelect.xml
./Aeon-Nox-master/1080i/DialogNumeric.xml
./Aeon-Nox-master/1080i/Custom_1135_IconCustomizer.xml
./Aeon-Nox-master/1080i/custom_1146_SmartPlaylistSelection.xml
./Aeon-Nox-master/1080i/custom_1130_MenuStyle.xml
./Aeon-Nox-master/1080i/custom_1114_TimeOutPopup.xml
./Aeon-Nox-master/1080i/MyMusicPlaylist.xml
./Aeon-Nox-master/1080i/Includes_Animations.xml
./Aeon-Nox-master/1080i/Includes_Weather.xml
./Aeon-Nox-master/1080i/DialogContextMenu.xml
./Aeon-Nox-master/1080i/VideoFullScreen.xml
./Aeon-Nox-master/1080i/Viewtype_BigFan.xml
./Aeon-Nox-master/1080i/custom_1124_MainMenuCustomizer.xml
./Aeon-Nox-master/1080i/DialogMediaFilter.xml
./Aeon-Nox-master/1080i/Includes_WidgetLayout.xml
./Aeon-Nox-master/1080i/Viewtype_Posters.xml
./Aeon-Nox-master/1080i/DialogVolumeBar.xml
./Aeon-Nox-master/addon.xml
ancien PC Toshiba satellite_c670d-11 / Linux Mint 21 Vanessa
Nouveau PC ASUS TUF GAMING A17 GPU RTX 4070 CPU AMD Ryzen 9 7940HS w/ Radeon 780M Graphics / Linux Mint 21.2 Victoria / Kernel: 6.4.8-1-liquorix / Desktop: Cinnamon
Hors ligne
#8 Le 22/12/2012, à 19:12
- MikeBZH44
Re : Commande Find ne marche pas comme attendue
Merci les gars.
Donc find . -name "*.xml" marche bien.
@ljere : si tu fais cd Aeon-Nox-master et que tu fais find . -name *.xml, ça me marchera pas car effectivement le *.xml est évalué et ça revient à faire find . -name addon.xml
Hors ligne
#9 Le 22/12/2012, à 19:46
- tiramiseb
Re : Commande Find ne marche pas comme attendue
Ça sous-entend (et c'est logique) que derrière -name on donne une 'pattern' donc une chaine de caractères.
Et donc l'étoile '*' doit être 'escapé' !
Le man de find devrait être revu....
Non, ça n'a rien à voir avec find et le man de find ne devrait pas être revu.
Les "*" ne sont pas interprétés par le programme que tu exécutes mais par le shell avant d'exécuter le programme.
Donc :
- s'il y a un (ou plusieurs) fichier(s) ".xml" dans le répertoire courant, le shell remplace *.xml par X.xml Y.xml Z.xml puis exécute la commande
- s'il n'y a pas de fichier ".xml" dans le répertoire courant, le shell ne remplace rien et exécute la commande avec la chaîne qui a été donnée
Sébastien Maccagnoni - https://www.maccagnoni.eu - https://www.domotego.com
Hors ligne
#10 Le 22/12/2012, à 22:58
- Maisondouf
Re : Commande Find ne marche pas comme attendue
donc quand je fais 'ls *.txt', c'est pas ls qui regarde tout les fichiers *.txt, mais c'est le shell qui repète la commande ls autant de fois qu'il y a de fichier a.txt, b.txt,...
ASUS M5A88-v EVO avec AMD FX(tm)-8120 Eight-Core Processor, OS principal Precise 12.04.1 LTS 63bits½
Bricoleur, menteur, inculte, inadapté social et mythomane, enfin d'après certains....
"the secret of my form is summed up in two words, no sport" (Winston Churchill)
Hors ligne
#11 Le 22/12/2012, à 23:37
- Postmortem
Re : Commande Find ne marche pas comme attendue
Salut,
donc quand je fais 'ls *.txt', c'est pas ls qui regarde tout les fichiers *.txt, mais c'est le shell qui repète la commande ls autant de fois qu'il y a de fichier a.txt, b.txt,...
Ce n'est pas tout à fait ça.
ls n'est exécuté qu'une seule fois.
Admettons que tu sois dans un repertoire contenant toto.txt et titi.txt.
Faire :
ls *.txt
Équivaut à taper :
ls titi.txt toto.txt
ls n'est exécuté qu'une fois mais pour tous les fichiers finissant par .txt
Edit :
Pour t'en rendre compte, tape ceci dans un repertoire contenant plusieurs fichiers finissant par .txt :
set -x
ls *.txt
On peut tres bien remplacer ls par echo et tu verras que echo ne t'affichera pas la chaine '*.txt' mais bien les différents fichiers finissant par .txt
Dernière modification par Postmortem (Le 22/12/2012, à 23:40)
Mot' a dit : « Un Hellfest sans Slayer, c'est comme une galette-saucisse sans saucisse ! »
Hors ligne
#12 Le 22/12/2012, à 23:40
- Maisondouf
Re : Commande Find ne marche pas comme attendue
OK, je comprends mieux
Merci, je me coucherai moins bête ce soir..
ASUS M5A88-v EVO avec AMD FX(tm)-8120 Eight-Core Processor, OS principal Precise 12.04.1 LTS 63bits½
Bricoleur, menteur, inculte, inadapté social et mythomane, enfin d'après certains....
"the secret of my form is summed up in two words, no sport" (Winston Churchill)
Hors ligne
#13 Le 22/12/2012, à 23:41
- Postmortem
Re : Commande Find ne marche pas comme attendue
OK, je comprends mieux
Merci, je me coucherai moins bête ce soir..
Ce forum m'a souvent fait me coucher moins bête aussi !!
Mot' a dit : « Un Hellfest sans Slayer, c'est comme une galette-saucisse sans saucisse ! »
Hors ligne