How to delete files from a folder using a list of file names

Discussion in 'Mac Basics and Help' started by CD2014, Aug 21, 2014.

  1. CD2014 macrumors newbie

    Joined:
    Aug 21, 2014
    #1
    Hi,

    I have 200,000 files in a folder, and I have a list of 3,000+ files on a plain txt file that I want to delete from of this folder.

    How do I remove these 3,000 files from the folder using an automated process?

    I looked in Automator and searched on Google but there are only answers for Windows users. If there's a way on Windows then there must be a way for Mac users as well.

    I'm running Lion OS on a macbook pro.

    Thanks
     
  2. Weaselboy Moderator

    Weaselboy

    Staff Member

    Joined:
    Jan 23, 2005
    Location:
    California
    #2
    I believe the suggestion at the bottom of this would work.
     
  3. CD2014 thread starter macrumors newbie

    Joined:
    Aug 21, 2014
    #3
    It worked but I had problems with the .txt file

    Hi, I ran in terminal the line of code at the end:

    cd /Volumes/space1; rm `cat remove.txt`

    But I had problems with my remove.txt file.

    I'm not sure if there is a better way to do it but I had to save it as .txt in Word for Mac with LF at the end to get it to work.

    Also the list was too long and I had to use ARG_MAX to find the limit of my argument which meant I had to cut my list into 3 parts

    Thanks for the direction
     

Share This Page