read list of filenames from text file and remove these files in multiple directories

I have a large list of filenames from an Excel sheet, which I then translate into a simple text file. I'd like to use this list, which contains various file extensions , to archive these files and then remove them recursively through multiple directories and subdirectories. So far, it looks like a combination of find, pipe, and xargs may work, but would like to consult some gurus. Thanks in advance!! >:)

first you have to copy those files into a directory or any where else
Let us consider "fil1" and fil2 and so on......

find / -type f -name "fil*" -exec rm {} \;

if any help ...let us know

Please give a try on this:

find dir_name -name file -print -exec tar -cvf arch.tar {} \; -exec rm -f {} \;
Ex:
find ./test_dir -name log_file* -print -exec tar -cvf log_arch.tar {} \; -exec rm -f {} \;

thank you.

Does the file contain file names or file extensions?

The best method will depend on the format of the file, the sanity of the filenames, etc.

The best way might be to move the files to another directory, then use whatever archiving method you like on that directory.

This code will retain the directory structure in the archive directory, so that multiple files of the same name can be accommodated:

archivedir=$HOME/arc
[ -d "$archivedir" ] || mkdir -p "$archivedir" || exit 1
while IFS= read -r file
do
  find . -name "$file" |
    while IFS= read -r f
    do
      dir=$archivedir/${f%/*}
      [ -d "$dir" ] || mkdir -p "$archivedir" || continue
      mv "$f" "$dir"
    done
done < FILE_WITH_LIST

i found this solutions in some forum lately...
it reads a list of files (with or without pathnames) from a file and removes/deletes them using rm.

xargs rm -rf </lists/blah.txt

this solutions seems to have a problem if using with files that contains SPACES and stuff..

others use this

 cat filename.txt | while read file; do rm "$file"; done

this worked for me on files with spaces.

Set IFS to a newline first, then it will work.

There is no need for cat:

while read file; do rm "$file"; done < filename.txt