Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Automator problem with actions on multiple files - error "No item references were passed to the Move Finder Items action. (-50)"

Hi,

I'm trying to do something that seems simple with automator, but something doesn't work.

I just would like to create a workflow that moves specific files from a folder to many other folders.

MULTIPLE different files with different criteria, frome the same folder, to MULTIPLE different folders.

Something like:

if in folder A there is a file named X, move it to folder B,

if in folder A there is a file named Y, move it to folder C,

if in folder A there is a file named Z, move it to folder D,

and so on...


Seems pretty basic to me, but the workflow just stops when it doesn't find any files responding that criteria (the name, or part of the name).

I found this thread, but the solution provided presents 2 problems for me:

- It works, skipping the steps where it doesn't find any file, until the end: at the end (even if I add "loop") the error shows up: No item references were passed to the Move Finder Items action. (-50)

- I need the workflow to be triggered by me, so I don't want to use a "folder action". But the app resulting from this workflow just doesn't work.


I'm sure I'm missing something stupid.

I attach the screenshot of my workflow (it is in italian, but it's quite easy to understand: CERCA=FIND, FILTRA=FILTER, SPOSTA=MOVE)

and the log.


I'm using Automator 2.1.1 on Mac 10.6.8

User uploaded file

and here's the log:

2015-05-27 19:02:30 +0200: Cerca elementi del Finder completati

2015-05-27 19:02:30 +0200: Filtra elementi del Finder completati

2015-05-27 19:02:30 +0200: Esegui AppleScript completati

2015-05-27 19:02:30 +0200: Cerca elementi del Finder completati

2015-05-27 19:02:30 +0200: Filtra elementi del Finder completati

2015-05-27 19:02:31 +0200: Sposta elementi del Finder falliti - 1 errore, 1 avviso

2015-05-27 19:02:30 +0200: All'azione “Sposta elementi del Finder” non sono stati forniti i dati necessari.

2015-05-27 19:02:31 +0200: No item references were passed to the Move Finder Items action. (-50)

Automator-OTHER, Mac OS X (10.6.8)

Posted on May 27, 2015 10:28 AM

Reply
Question marked as Best reply

Posted on May 28, 2015 11:15 AM

Hello


Automator is a vehicle without steering. You don't have to dance with it in order to accomplish what you want.


Something like the following AppleScript should work. Please change the relevant paths as you see fit.



set src to "/path/to/finiti" as POSIX file as alias set saga to "/path/to/saga" as POSIX file as alias set hulk to "/path/to/hulkprova" as POSIX file as alias tell application "Finder" move (src's files whose name extension contains "cbr" and name contains "saga") to saga move (src's files whose name extension contains "cbr" and name contains "hulk") to hulk end tell



Regards,

H

3 replies
Question marked as Best reply

May 28, 2015 11:15 AM in response to piloro

Hello


Automator is a vehicle without steering. You don't have to dance with it in order to accomplish what you want.


Something like the following AppleScript should work. Please change the relevant paths as you see fit.



set src to "/path/to/finiti" as POSIX file as alias set saga to "/path/to/saga" as POSIX file as alias set hulk to "/path/to/hulkprova" as POSIX file as alias tell application "Finder" move (src's files whose name extension contains "cbr" and name contains "saga") to saga move (src's files whose name extension contains "cbr" and name contains "hulk") to hulk end tell



Regards,

H

Jun 2, 2015 5:08 AM in response to Hiroto

Fantastic!
This solution works, but there's still a little problem:

this Applescript just copies the files, it doesn't MOVE them. Maybe it is because the destination path is on an external hd?

Maybe, I don't know, it is possible to add a command just to delete the original files, after the copy has been successful?


And, if you are so patient, there is another thing:

I noticed that if the entire process stops if in the destination folder (in one of the various destination folders) there is a file with the same name.

And it doesn't specify which file nor where: working with a big number of files, it could be a real trouble.

Is it possibile to add a command in order to make it skip files with the same name (or errors in general?)


Thank you very much!

Jun 2, 2015 2:27 PM in response to piloro

Hello


When you need finer control over file system manipulations, you'd better use shell commands in lieu of cumbersome Finder.


The following AppleScript script is a simple wrapper of shell script, which should, for instance, move *saga*.cbr in src directory to destination saga directory without overwriting existing files in destination.



set src to "/path/to/finiti" set saga to "/path/to/saga" set hulk to "/path/to/hulkprova" set args to "" repeat with a in {src, saga, hulk} set args to args & space & a's quoted form end repeat do shell script "/bin/bash -s <<'EOF' - " & args & " # >> ~/desktop/mv_log_\"$(date '+%F_%H%M%S')\".txt SRC=$1 SAGA=$2 HULK=$3 find \"$SRC\" -type f -depth 1 -iname '*saga*.cbr' -print0 | xargs -0 -J% mv -n -v % \"$SAGA\" find \"$SRC\" -type f -depth 1 -iname '*hulk*.cbr' -print0 | xargs -0 -J% mv -n -v % \"$HULK\" EOF"




* Currently the script will return verbose output from mv(1) command as result. If you want to save it to a log file, you may remove the # in the first line of do shell script statement so that it reads:


do shell script "/bin/bash -s <<'EOF' - " & args & " >> ~/desktop/mv_log_\"$(date '+%F_%H%M%S')\".txt



and the output is saved to a log file named after mv_log_YYYY-MM-DD_HHMMSS.txt on desktop, where YYYY-MM-DD_HHMMSS is time stamp.



Hope this may help,

H

Automator problem with actions on multiple files - error "No item references were passed to the Move Finder Items action. (-50)"

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.