unix

How do I delete files from a file list with spaces on my Linux server?

If you have a list of file names that contain spaces, you can use a command like the example below to remove them.

while read file;do rm “$file”;done < /tmp/inputfile What that does is reads the input file /tmp/inputfile and removes each one. The quotes around $file are important and if they are not used the file will not be read properly.

1 Comment

1 Comment

  1. sell this domain at sedo

    October 19, 2010 at 7:57 am

    Super stuff! This was a really helpful post.

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top