Moving files to the Trash with Automator

I'm having some problems with Automator, and I'm hoping it's just a simple step I'm missing.
I have a list (text file) of a group of files I wish to remove from a folder (about 650 or so files, from a folder of about 8000). I have been able to get Automator to read the text file, and show me the result.
(Ask for Finder Items (Files & Folders), Combine Text Files (Text), Filter Paragraphs [Return Paragraphs That Are Not Empty] (text))
This results in showing me my list of files I wish to remove.
I don't quite get how to pass this list on to the Finder to tell it to select these files, and move them to the trash.
Any assistance would be appreciated.

Since your text file just has the names, an action is needed to build the complete file path. Most of Apple's text and file actions don't use variables, but a Run AppleScript action can be used to fill in the blank. Give this workflow a try (I haven't tested it with a large number of files, so I don't know how slow it will be):
1) Ask for Finder Items {Files} -- choose the text file
2) Combine Text FIles
3) Filter Paragraphs {Return paragraphs that are not empty}
4) Run AppleScript -- paste the following script:
<pre style="
font-family: Monaco, 'Courier New', Courier, monospace;
font-size: 10px;
font-weight: normal;
margin: 0px;
padding: 5px;
border: 1px solid #000000;
width: 720px;
color: #000000;
background-color: #FFEE80;
overflow: auto;"
title="this text can be pasted into an Automator 'Run AppleScript' action">
on run {input, parameters} -- build file paths from a list of names
set output to {}
set SkippedItems to {}
set TheFolder to (choose folder with prompt "Select the folder containing the files:") as text
repeat with AnItem in the input
try
set AnItem to (TheFolder & AnItem)
get AnItem as alias -- test
set the end of the output to the result
on error
set the end of SkippedItems to AnItem
end try
end repeat
if SkippedItems is not {} then
display alert "Error with AppleScript action" message ((count SkippedItems) as text) & " items were skipped (file not found)"
end if
return output
end run</pre>
5) Move Finder Items to Trash

Similar Messages

  • Suddenly I have problems moving files to the trash...  get a dialog saying Finder wants to make changes and I must provide the password... Any explanation or ideas how I can get this to stop?

    Suddenly I have problems moving files to the trash...  get a dialog saying Finder wants to make changes and I must provide the password... Any explanation or ideas how I can get this to stop?

    Please take these steps if you're prompted for a password when moving items in your home folder to the Trash.
    1. Triple-click anywhere in the line below on this page to select it:
    ~/.Trash
    2. Right-click or control-click the highlighted line and select
    Services ▹ Show Info
    from the contextual menu.* An Info dialog should open.
    3. The dialog should show "You can read and write" in the Sharing & Permissions section. If that's not what it shows, click the padlock icon in the lower right corner of the window and enter your password when prompted. Use the plus- and minus-sign buttons to give yourself Read & Write access and "everyone" No Access. Delete any other entries in the access list.
    4. In the General section, uncheck the box marked Locked if it's checked.
    5. From the action menu (gear icon) at the bottom of the dialog, select Apply to enclosed items and confirm.
    6. Close the Info window and test.
    *If you don't see the contextual menu item, copy the selected text to the Clipboard by pressing the key combination command-C. Open a TextEdit window and paste into it (command-V). Select the line you just pasted and continue as above.

  • How do you move a file to the trash with ONE keystroke (Can't believe I'm wasting time on this!)

    Everytime I want to send a file to the trash, I have to either perform some kind of key combination/shortcut or use the trackpad/mouse, right click and select "move to trash", or drag the file(s) to the trash!  This is absolutely ridiculous.  Why can't I just press the delete button??? I cannot take it anymore!  It's such a waste of time.
    After some research, I finally found a post with the answer I was looking for from user  par larsson 
    Re: How delete a file in mac os x?
    "You can also go into System Preferences and make a new keyboard shortcut. I turned one of the function keys into a "Move To Trash" key.
    1. No need to use the mouse for something that should be simple and quick.
    2. Single button press just like in Windows."
    Seriously!
    Now the problem is how do you do this?
    1. I went to the system prefs > Keyboard > Keyboard and checked "use F1, F2, etc... as standard function keys.."
    2. Under keyboard shortcuts, I selected "Application Shortcuts" and clicked on the "+" sign
    3. I selected the finder application, entered "Move To Trash" in the action box, and F12 as the key (because it's next to "delete")
    That did not work.  It just opened the dashboard instead.
    4.  I went back to "keyboard shortcuts" and found F12 was already assigned to open the dashboard.  So I unchecked it and tried again.
    That still didn't work.  I would select the file to be moved to trash, press F12, and after an error "beep" sound, the last file in the folder was highlighted.

    Duuuuuuuuuuuuuuuuuuuuuuuude!!!!!!!!!!!!  YOU DID IT!  I cannot believe it!
    I changed "Move To Trash" to "Move to Trash" and selected a file.  I had lost all hope, so I took a minute to prepare myself for yet another moment of deep frustration.  Then I pressed F10, and bang! the file was trashed!!!  It took me a couple minutes to actually believe what just happened.  Thank you so much!  If I could, I would "like" you as many times as I can physically hit the "Liked" button!
    PS: what the heck is wrong with Apple though???  Wrong instructions, incorrect help instructions on their own site.  The chances of figuring this out before having a nervous breakdown were like one in a million (approximately, I did not actually do the math).  Last week, the keyboard and the trackpad stopped responding on my brand new macbook pro for a couple hours. I was not the only one with this problem.  Apparently, this was from a design flaw, which means it could happen again at any time.  iMovie doesn't work.  TextEdit keeps crashing all the time.  Emptying the trash can take hours. 
    Since 2000, I bought a PMac G4 Quicksilver, a used PMac G3 Blue, a used iBook G4, a used Pismo PBook G3, a used Graphite iMac G4, a used iMac G3 (green, 233MHz I think) and I already had more problems with this brand new macbook pro than will all the other macs combined...  For such an expensive machine, with 16GB of RAM, that's a little dissapointing, especially from Apple.  Maybe I'm just not lucky.
    Anyways, thanks again!  Best moment of 2014!

  • I can't delete a file in the trash that has strange symbols (␀ ␀獭潤) in its filename.

    There is a file in the Trash with a filename containing strange symbols, along with some Chinese characters. For some reason when I empty the Trash, all files are deleted as expected, expect this one particular file. The symbols are: ␀ ␀獭潤 — although some of the symbols I was unable to copy, which is probably why they are causing problems.
    How can I get rid of these files? Even in Terminal it says that the file does not exist.

    I'd like to point out that in my problem, the problematic file is actually on a USB drive, not on the Mac's internal drive. The USB is formatted FAT32.
    Anyway, I ended up reformatting the disk since it's an external drive so it wasn't much hassle. It's essentially like nuking the whole thing, which is a bit overkill, but I couldn't figure out how to fix this since the two apps recommended by the link you provided (Trash It and Cocktail) both failed to delete the file.

  • HT1526 I'm trying to delete files from the trash and an .InProgress file in Time Machine that cannot be moved to the trash. I cannot unmount the TM disk either.  If I use the chflags -R nouchg  command, I get a "Resource busy" message. Any suggestions?

    I've got one or maybe two problems.  Time Machine routinely crashes and there is a file in the TM folder that is an .InProgress file at the end of successful backups. Can't delete it, even using various sudo commands in Terminal.  These come back with a "Resource busy" message.
    Similarly, there is a Microsoft Office alias in my trash that will not delete, again including various delete or Terminal commands.  Also "Resource busy"
    I can't reformat the TM volume since it cannot unmount and it also cannot unmount the whole disk, which contains some other backup files I'd rather keep.
    Any suggestions?
    Mike

    I'm not sure I can be very helpful since I was doing a lot of things and ultimately the problems went away.  But one thing that definitely seemed to help was to shut down, restart, do something, shut down again and repeat.  So with a clean start, try to move the file to the trash.  If that works, shut down restart and look to see if it is still in the trash.  Empty the trash. Shut down if it appears to empty and then restart.  It seemed sometimes that the computer was doing what I wanted then something was overriding this and restoring.  The shutdowns immedately after I could do something but before it engaged an override operation seemed to keep this from happening. 
    Sorry to not have more to offer but...

  • I used a third party programme called Mackeeper UGHHH,it moved loads of files to the trash now i do not know where they originally came from or belong!! the put back option is in grey??how can i manually put these files back where they belong?SO upset!!

    I used a third party programme called Mackeeper UGHHH SOOO Stupid i know,it moved loads of files to the trash now i do not know where they originally came from or belong!! the put back option is in grey??and will not work even when i highlight one by one!!
    how can i manually put these files back where they belong?
    i know i should have used time machine but i have not set it up and its too late for that now
    i have been researching and racking my brain on how to put these folders and contents of them back to where they once were all of the contents of the folder are still in tact AND i have not emptied my trash,my programmes and some of my apps are not working properly now...i use my computer alot for making music and things are jumbled up now...
    is there anyone out there who knows the answer to my prayers on how to go about putting these folders/files back to where they came from to restore functionality to my mac..Yes and thank u if u were going to tell me i HAVE un installed mackeeper...A very sad and upset Mac user!! Cheers Shane

    hello there thank u so much for ur reply!! ok i uninstalled mackeeper now and the put back option is still in grey im so confused...i tried restarting my computer like u said and put back still in grey??!! the files that are in my trash are everything from Accounts,address book plug-ins,address book,adobe,aim.........then stuff like apple,Audio,....to caches color pickers,colors,com.apple.TCC,to DVD player to facebook,google to ilifemedia browser to itunes to keychains to movie effects,preferences printers to skype...my Native instruments files BUT not all of them my garage band but not all of it...it seriously looks like my whole library is in the trash i tried to put things back where i THINK they belong and it just added the item or folder under where i thought it went and didnt restore functionality to for instance google chrome and all my book marks are there....they seem to be only certain things from my library that would have added some functionality to apps and programmes like my garageband is missing stuff photobooth wont work so on.......kinda looks a bit like this thats only the half of it!! Cheers shane!!!

  • Problems with deleting files to the trash

    I cant delet files to the trash. The only option is to delet permanently.
    "The file wil be deleted immediately, are you shure you want to proceed?"
    (bad translation from norwegian)
    can anyone please help me?
    -w-

    W, Welcome to Apple Discussions.
    Choose your Home folder and "Get Info" (command-i). Under "Ownership & Permissions" be sure you have "Read & Write" privileges. Under "Details", be sure you are the owner.
    -mj
    [email protected]

  • I dragged my ext. HD iTunes backed up folder into my new mac. Now there are duplicates of every song!! The problem is both versions seem to actually BE there when I check the info. Now I have no idea if iTunes is playing the files in the trash or not

    Hi. I'm in a situation here and would really welcome some guidance. I dragged my ext. HD iTunes backed up folder into my new mac. Now there are duplicates of every song. Both versions seem to actually BE there when I check the info. So, I moved what I thought were duplicates into the trash from iTunes, and resigned myself to the fact that I would have to do this manually for each album. I did this with about 10 albums. I emptied the trash and lost them even though they still LOOKED like they were in iTunes. I repeated the process tonight on a bunch of other albums not realizing yet that I had screwed up terribly the first time. This time I saw what had happened and pulled the files out of the trash, onto my desktop and dragged them back into iTunes, then deleted the duplicate files that had exclamation points next to them. Now I have no idea if iTunes is playing duplicate files from the trash or not, and am nervous about emptying the trash. Anyone dealt with this before? Thank you

    Hi. I'm in a situation here and would really welcome some guidance. I dragged my ext. HD iTunes backed up folder into my new mac. Now there are duplicates of every song. Both versions seem to actually BE there when I check the info. So, I moved what I thought were duplicates into the trash from iTunes, and resigned myself to the fact that I would have to do this manually for each album. I did this with about 10 albums. I emptied the trash and lost them even though they still LOOKED like they were in iTunes. I repeated the process tonight on a bunch of other albums not realizing yet that I had screwed up terribly the first time. This time I saw what had happened and pulled the files out of the trash, onto my desktop and dragged them back into iTunes, then deleted the duplicate files that had exclamation points next to them. Now I have no idea if iTunes is playing duplicate files from the trash or not, and am nervous about emptying the trash. Anyone dealt with this before? Thank you

  • How can i RECOVER a time machine file from  the trash

    I hope someone can help me... I have spent hours and hours reading forums but none that have addressed my problem.
    My daughter gave me her old backup drive.  She also has a MAC so she had Time Machine backups on the drive already.  I started backing up onto this drive about a year ago.  Backups have been done now for a year or so.  Last night I got the message that I was running out of space so I looked at the drive and realized that her backups were still on the drive so I moved them into the trash.  Then Time Machine wouldn't work anymore and I realized that not only did her backups get moved but all of mine did as well.  I need the backups because after I upgraded to Mavericks many of my photos dissappeared from iPhoto.  These are photos that I can't recreate - I sell jewelry and take pictures before I send the piece out.  Everything is one-of-a-kind so it's very important for me to get these back.  I realize now that I never should have moved the backups into the trash as I will have a problem deleting it once I separate her backups from mine but I will deal with that after I figure out this problem.
    Is there anything I can do to move the backups back from out of the trash and into Time Machine again? (BTW - I don't know which version of Mavericks I have - I have done all available updates so I assume it is 10.9.3)

    As long as you don't delete the trash, the files should be recoverable.
    I suspect using the Put Back command could take a long time, so be patient.
    If your Time Machine backups are mixed with your daughter's backups you might want to buy a larger drive and move the Time Machine files to the new drive.
    Regarding missing photos in iPhoto...There might be options to rebuild/recover that data from iPhoto rather than trying to revert to a Time Machine backup.
    Check out this third party app, iPhoto Library Manager. It has a demo.
    http://www.fatcatsoftware.com/iplm/
    Options for a larger drive.
    I like the Seagate USB 3.0 Backup plus drives. Works on USB 2.0 ports. They come formatted for PC but easy to format in Disk Utility.
    I don't recommend Western Digital because of the boot problem with some of their drives.
    LaCie makes good drives.
    All Mac formatted drives will cost more and it’s easy to reformat with Disk Utility. Do not use the software that comes with the drives. It’s recommended that you use Apple’s Disk Utility.
    Prices vary but this gives you an idea of what you’ll find. As you notice the second and third TB is usually only $15 more per TB. Normally, you’ll find these prices but right now the 1T is more than the 2T
    Seagate Backup Plus 1 TB USB 3.0 $85
    Seagate Backup Plus 2 TB USB 3.0 $99
    Seagate Backup Plus 3 TB USB 3.0 $115
    I have seen the 3T on sale for $99.
    Locally, Best Buy seems to have the best prices.

  • I have sent a file to the trash bin. When I come to empty the trash bin everything goes out except this one particular file and I get a note saying the file is 'in use' but it is not. How can I delete this file from trash?

    I have a Macbook Pro with OS X Lion 10.7.2. I have sent a work file to the trash bin along with many other files. When I empty the trash this one particular file remains and I get a message that this file is still in use. I have tried returning the file to my documents, opening it, closing it and then sending it to trash and again I try to empty trash but the same message comes up - Q - How can I trash this file permanently?

    First just try logging out and back in.  Whatever is holding on to it may not be running after the logout thus freeing it so you can trash it after logging back in.
    You might also try Trash It!
    Lastly, look at the following for suggestions:
    The X Lab: Solving Trash Problems

  • I can't put some files in the Trash

    Hello everyone,
    Unfortunately, I'm having some trouble putting some files in the trash...
    They say they're adobe dreamweaver files, but I've never installed dreamweaver - I was only flagged up about them when I tried to install dreamweaver, and was told that it was already installed and I needed to remove any files etc.
    So I did a search for all adobe or dreamweaver files, and sure enough there they were. I consequently tracked to whack them all in the bin, but to no avail. The computer would say "this will permanently delete the file, are you sure?" - I would click yes, and it froze for a moment every time I tried and then popped up with this error message:
    "Sorry, the operation could not be completed because an unexpected error occurred
    Error code -61"
    Here's a screen grab:
    http://img78.imageshack.us/my.php?image=picture2cb3.png (the error message)
    http://img213.imageshack.us/my.php?image=picture3sx0.png (the files in question are highlighted)
    If anyone knows how I could delete these, that would be extremely helpful...
    I've tried the get info, unlocking trick, and there's been no joy there - the read only options are faded out and not possible to change. I've also tried TrashIt, which was recommended, and didn't work...
    Any ideas would be very kind, thanks...

    I can't find my OSX disk
    I don't really understand this (that disk shows up in the screenshot you uploaded of the Finder window resulting from your search), but I also think it's irrelevant.
    I went back and read your original post, and I saw this: 'The computer would say "this will permanently delete the file, are you sure?"'. I've since seen another entry in this Topic List which indicates that you get such a message when your .Trash folder is gone. (Of course, there may be other reasons why you can get the message too.) If that's true, then you really need to fix it. One easy way to find out is, try creating an ordinary file in your home directory, and then drag it to the trash? Does that work? I suspect you'll get the same message about "this will permanently delete the file, are you sure". But if you say "yes", it should succeed in deleting it. But it does indicate that your .Trash folder is probably gone.
    if I create a new account that is also an administrator, then bin them, are you sure this will work?
    (I assume that by "bin them", you mean "drag them to the trash".) In fact, you can just create a new account that isn't an administrator (unlike what I said in my previous post). If that account drags the stuff to its trash, Finder will prompt it for the name of an administrator account (like, yours), and its password. If you provide it, then empty that account's trash, the stuff should go away just fine.
    Incidentally, the Subject of the item I mentioned above is "Trash deletes any file without emptying".
    If I'm right about your trash not working, and you want a way to "fix" it, you can get back. Or maybe make a new problem.

  • How to identify the original source folder of files in the trash?

    I am trying to help a friend who trashed a massive amount of files. Dragging files out of the trash to where they originated from works when one knows where files in the trash came from. What I need to know is how to find out which folder the files originated from. Pictures from iPhoto library, easy ... but there are others that are a mystery.
    Any help is appreciated.
    She is using a macbook running Leopard.

    The only way anyone here could possibly tell where files came from would first have a list of the files with the exact file names. The files themselves don’t carry information of any previous paths, that I know of.
    With the photos, as you said, easy. If they are applications, again, easy, Applications folder. But if they are System files, those can be scattered all over.
    You said it is a massive number of files, so unless the vast majority are photos or applications, it would probably not be practical to make a list.

  • What is the system doing when I empty a large file from the trash?

    I am in the process of deleting my old iPhoto library. When I installed OS X 10.10.3 it created a new Photos Library.photoslibrary and left the old iPhotos library as an archive. The old library is 249 gigabytes. I don't have "Empty Trash securely" on, and yet it is taking hours for the Finder to empty the trash with the 249 gigabyte iPhotos library in it. What is odd is that for a time, the amount of free space on my MacBook was increasing. It went from 77 GB to 88 GB, and then it started dropping all the way to 70 GB free. Now it is back up to 83.61 GB free.
    What is the Finder doing when it deletes a huge file? I realize that the iPhotos Library is not a single file, but contains hundreds of folders and thousands of files. Still I find it odd that it is taking it so many hours to delete, and that the amount of free space on my Mac goes up and down and up. Can someone explain this?
    It has been deleting for 4 hours and based on the "Emptying the Trash …" progress bar, it should take another two to three hours.

    Yes, but why would the space available go up and down and up as the files are deleted? If the Finder is deleting the files, shouldn't the free space on the drive be steadily increasing as the Trash is emptied?

  • Why cannot I move any files to the trash from my external drive?

    I have Snow Leopard 10.6.8 and an external hard drive Toshiba.  I've formatted it to be used with OSX and have copied lots of files there for use as a third hard drive to save files on.   But I now have found out that I cannot delete any files from this drive.  When I try to move any type of file to the trash, I get this message:  "The operation can’t be completed because an unexpected error occurred (error code -50)."   I've checked Info on these files and they are not locked.  Can someone help me with this?

    http://www.thexlab.com/faqs/trash.html. BTW, the error is: paramErr  = -50,  /*error in user parameter list*/, which usually indicates a permissions problem. CMD+I on that disk's Desktop icon, select ignore ownership, then try again.

  • Moving mail to the trash icon does not delete the mail.

    I am using an iPad with OS Ver 7.0.2. Moving mail to the "Trash" icon does not delete the mail from the Inbox. This is not a problem on my iPhone. Settings are the same on both devices

    First thing to try is a reset: hold the on/off button and the hold button at the same time until the iPad completely shuts down, then turn back on.
    May not work, but often resolves simple app issues.

Maybe you are looking for

  • Can't get ipod to work properly

    I registered my ipod on MY computer, but had my SIL (son in law) help me on HIS computer, which has WIFI. (He set mine up to use wifi) Now my computer won't recognise my ipod using the connector cable, says wifi is not available. I have turned wifi o

  • STO with delivery in 1 step (mvt. type 647) with serial numbering

    Hi, Error message IO306 ("Movement type 647 does not currently support serial number management") is generated when I try to Post Good Issue in a delivery with movement type 647 (stock transport order with delivery in 1 step). Does anyone know how to

  • Irritating high pitched constant buzzing sound....

    Im wondering if this has happened to anyone else and what it could be? its just this constant reaaaaaally high buzzing-doesnt seem to be any other problems. the sound stays if i put the computer to sleep and only goes if its fully shut down. the buzz

  • Unable to customize my portal masthead

    Hi, I am unable to customize my portal masthead. I can't download the par file like "System Administration -> Support -> Portal Runtime -> Browse Deployment -> WEB-INF -> deployment -> temp (or) pcd -> com.sap.portal.navigation.masthead.par.bak ". I'

  • Can I install mac os x 10.4 tiger on my PC?

    Somebody can tell me : how to install mac os x 10.4 on my PC