I have a large amount of folders and files.
I need to parse it and find only those with the extension xmp
to finally remove them.
How can I achieve this and keep track of the name of the removed files?
To find: I know I can use find /path -name "*.xmp"
But how can I run two commands on the output? keep file path and name in removelist.txt
and remove it.
Best Answer
With GNU find's
-fprint
and-delete
actions:-fprint file
- print the full file name into filefile
. Iffile
does not exist whenfind
is run, it is created; if it does exist, it is truncated.-delete
- delete files