<![CDATA[Forum Ubuntu-fr.org / [script] extraire les nouveaux fichiers d'une arborescence (zotero)]]> http://forum.ubuntu-fr.org/viewtopic.php?id=1063541 Thu, 11 Oct 2012 15:31:04 +0000 FluxBB <![CDATA[Réponse à : [script] extraire les nouveaux fichiers d'une arborescence (zotero)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=11086461#p11086461 c'était pas dit dans la chanson que tu voulais pouvoir valider avant le lancer....

]]>
Thu, 11 Oct 2012 15:31:04 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=11086461#p11086461
<![CDATA[Réponse à : [script] extraire les nouveaux fichiers d'une arborescence (zotero)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=11077711#p11077711 Je viens de penser qu'il faut initialiser le fichier de référence la première fois avec :

touch -t date_désirée_au_format_YYYYMMDDhhmm ref

à lancer dans le dossier d'exécution du script.

]]>
Wed, 10 Oct 2012 19:10:51 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=11077711#p11077711
<![CDATA[Réponse à : [script] extraire les nouveaux fichiers d'une arborescence (zotero)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=11076971#p11076971 wink

merci nesthib!

]]>
Wed, 10 Oct 2012 17:55:32 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=11076971#p11076971
<![CDATA[Réponse à : [script] extraire les nouveaux fichiers d'une arborescence (zotero)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=11074161#p11074161 Non, grsync ne correspond pas à mon besoin.
Premièrement grsync est graphique (quand j'ai besoin de faire de la sauvegarder j'utilise rsync), ensuite je peux prévisualiser simplement puis lancer l'action avec mon script, enfin je peux ajouter les extensions que je désire, il suffit de modifier le -name en -regex et d'utiliser les différents types de fichier (pdf|autre).

]]>
Wed, 10 Oct 2012 14:06:24 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=11074161#p11074161
<![CDATA[Réponse à : [script] extraire les nouveaux fichiers d'une arborescence (zotero)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=11071801#p11071801 Pal mal, mais regardes du coté de 'grsync', il fait ça très bien... et pour toutes sortes de fichiers.

]]>
Wed, 10 Oct 2012 09:55:24 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=11071801#p11071801
<![CDATA[[script] extraire les nouveaux fichiers d'une arborescence (zotero)]]> http://forum.ubuntu-fr.org/viewtopic.php?pid=11069891#p11069891 Voici un petit script créé à l'origine pour zotero mais qui peut être adapté à bien d'autres utilisations.
Le script recherche les nouveaux fichiers pdf (depuis la dernière extraction) dans ZOTERO_FOLDER et effectue un lien en dur dans PDF_FOLDER (possibilité de déplacer ou copier en remplaçant ln par mv/cp). La date de dernière synchronisation est sauvegardée par le fichier « ref ».

#! /bin/bash

# define working directories
ZOTERO_FOLDER="/source"
PDF_FOLDER="/destination"
FILE_TYPE='*.pdf'

cd ${ZOTERO_FOLDER}

# print last synchro date
echo "dernière synchronisation : "$(ls -l ref | awk '{print $6" "$7}')

# listing mode, only show new files
if [[ ! "${1}" == "-do" ]]
then
    find ./ -name ${FILE_TYPE} -newer ref
    exit
fi

# find files newer than last synchronisation and send to the PDF_FOLDER
while read file
do
    ln "${file}" "${PDF_FOLDER}" && echo "synchro : ${file}" || echo "/!\ erreur : ${file}"
done < <(find ./ -name ${FILE_TYPE} -newer ref)

# update reference file for next synchro
touch -t $(date +'%Y%m%d%H%M') ref

pour voir les nouveaux fichiers :

./le_script.sh

pour effectuer la synchronisation :

./le_script.sh -do
]]>
Wed, 10 Oct 2012 06:11:05 +0000 http://forum.ubuntu-fr.org/viewtopic.php?pid=11069891#p11069891