Linux CLI tip

Is your browser’s download folder slowly filling up with copies of pdf’s and other files that you downloaded twice or more times?

You recognise them instantly whenever you look at the list of files in that folder

file foo.pdf file foo (1).pdf file foo (2).pdf

Here are two easy ways to get rid of these two copies:

find . -name "*\([12]\)*" -print0 | xargs -0 rm

or, shorter:

ls -b *\([12]\)* | xargs rm

Avatar
Gijs Hillenius
Context for Digital Government

Policy specialist on open source in public services, knowlegde transfer expert