PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > comp.unix.shell > bash, delete the content of a directory
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
comp.unix.shell Using and programming the Unix shell.

bash, delete the content of a directory

Réponse
 
LinkBack Outils de la discussion
Vieux 25/05/2007, 07h48   #1
di0rz`
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut bash, delete the content of a directory

hi, everyone
i am looking for a tip to delete the content of a directory without
deleting the actual directory with bash

thank you

  Réponse avec citation
Vieux 25/05/2007, 08h04   #2
Chris F.A. Johnson
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bash, delete the content of a directory

On 2007-05-25, di0rz` wrote:
> hi, everyone
> i am looking for a tip to delete the content of a directory without
> deleting the actual directory with bash


shopt -s dotglob
rm -rf "$dir"/*

--
Chris F.A. Johnson, author <http://cfaj.freeshell.org/shell/>
Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
===== My code in this post, if any, assumes the POSIX locale
===== and is released under the GNU General Public Licence
  Réponse avec citation
Vieux 25/05/2007, 08h11   #3
SiKing
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bash, delete the content of a directory

di0rz` wrote:
> i am looking for a tip to delete the content of a directory without
> deleting the actual directory with bash


$ man rm

Try:
$ rm -rf <directory>/*
$ rm -rf <directory>/.* # if you also want to hit dot-files

Or is there something that I missed?


--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GE d+(-) s+: a@ C+ ULAHS++$ P- L+>++ E--- W++ N++ o !K w--(+) O- M?>+ V? PS+
PE+(++) Y+ PGP- t+ 5 X R !tv b+ DI(+) D G e++ h---- r+++@ y++++
------END GEEK CODE BLOCK------
  Réponse avec citation
Vieux 29/05/2007, 00h59   #4
di0rz`
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: bash, delete the content of a directory

thanks it's working


On May 25, 8:11 am, SiKing <nos...@noway.invalid> wrote:
> di0rz` wrote:
> > i am looking for a tip to delete the content of a directory without
> > deleting the actual directory with bash

>
> $ man rm
>
> Try:
> $ rm -rf <directory>/*
> $ rm -rf <directory>/.* # if you also want to hit dot-files
>
> Or is there something that I missed?
>
> --
> -----BEGIN GEEK CODE BLOCK-----
> Version: 3.1
> GE d+(-) s+: a@ C+ ULAHS++$ P- L+>++ E--- W++ N++ o !K w--(+) O- M?>+ V? PS+
> PE+(++) Y+ PGP- t+ 5 X R !tv b+ DI(+) D G e++ h---- r+++@ y++++
> ------END GEEK CODE BLOCK------



  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 14h27.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10346 seconds with 12 queries