[Fedora-users-br] Dúvida sobre rm

Alberto Monteiro albmont em centroin.com.br
Ter Ago 28 13:42:31 UTC 2007


Reginaldo Carvalho escreveu:
>
> Adilson, obrigado pela sua colaboração... mas esse procedimento
> não funcionou... 
>
Eu não recomendo que seja feita uma "chacina" de arquivos,
pelo risco de apagar alguma coisa importante. Mas sempre tem
o find para matar tudo:

find /dir-origem -name "*.txt" -exec rm -v {} \;

Mas, como eu disse antes, eu NÃO recomendo que esse "seek and
destroy" seja usado. Eu sugiro algo como:

mkdir /dummy-dir
find /dir-origem -name "*.txt" -exec mv -vi {} /dummy-dir \;

desta forma, os *.txt serão movidos para o diretório dummy -
assim, se alguma coisa der errado (e alguma coisa _sempre_
dá errado), dá pra recuperar os arquivos.

Aliás, um procedimento mais tranquilo é fazer em três etapas.
Na primeira, os arquivos .txt são listados, na segunda,
verificados e na terceira eliminados:

# 1a etapa
xmms Metallica_-_Seek_And_Destroy.mp3 # para inspirar
echo "# Seek and Destroy" > seek_and_destroy.sh
for x in `find /dir-origem -name "*.txt"`
do
  echo "rm -v $x" >> seek_and_destroy.sh
done

# 2a etapa
cat seek_and_destroy.sh

# 3a etapa
sh seek_and_destroy.sh
rm seek_and_destroy.sh

Alberto Monteiro

PS: isso funcionava no FC4. Não sei se funciona no FC6 :-P
--

We are scanning the scene
In the city tonite
We are looking for you
To start up a fight
There is an evil feeling
In our brains
But it is nothing new
You know it drives us insane

  Running
  On our way
  Hiding
  You will pay
  Dying
  One thousand deaths
  Running
  On our way
  Hiding
  You will pay
  Dying
  One thousand deaths

    Searching
    Seek and Destroy
    Searching
    Seek and Destroy
    Searching
    Seek and Destroy
    Searching
    Seek and Destroy

There is no escape
And that is for sure
This is the end we won't take any more
Say goodbye
To the world you live in
You have always been taking
But now you're giving

  Running
  On our way
  Hiding
  You will pay
  Dying
  One thousand deaths
  Running
  On our way
  Hiding
  You will pay
  Dying
  One thousand deaths

    Searching
    Seek and Destroy
    Searching
    Seek and Destroy
    Searching
    Seek and Destroy
    Searching
    Seek and Destroy

Our brains are on fire
With the feeling to kill
And it will not go away
Until our dreams are fulfilled
There is only one thing
On our minds
Don't try running away
Cause you're the one we will find

  Running
  On our way
  Hiding
  You will pay
  Dying
  One thousand deaths
  Running
  On our way
  Hiding
  You will pay
  Dying
  One thousand deaths

    Searching
    Seek and Destroy
    Searching
    Seek and Destroy
    Searching
    Seek and Destroy
    Searching
    Seek and Destroy





Mais detalhes sobre a lista de discussão Fedora-users-br