Re: Using automator to place hundred of files in a single folder
Re: Using automator to place hundred of files in a single folder
- Subject: Re: Using automator to place hundred of files in a single folder
- From: David Hoerl <email@hidden>
- Date: Wed, 30 Jan 2013 11:12:23 -0500
For the archives, I sent the original poster this solution, an
Application, input as arguments, using /bin/ksh.
I didn't use "cd" since if that failed you could really wreck havoc. I'm
open to suggestions on how to better bullet proof it. Hmmm - maybe
confirm the folder path?
Anyway:
if [ $# -ne "1" ]
then
osascript -e 'tell application "Finder" to display alert "No Folder"
message "Please drop a folder on this app"'
exit 0
fi
if [ ! -d "$1" ]
then
osascript -e 'tell application "Finder" to display alert "No Folder"
message "Please drop a folder on this app, not a file"'
exit 0
fi
for d in $(ls "$1")
do
find -d "$1/$d" -type f -exec mv -n {} "$1" \; -print >> /tmp/log.txt 2>&1
echo "MOVED FILES" >> /tmp/log.txt
find -d "$1/$d" -type d -exec rm -rf {} \; -print >> /tmp/log.txt 2>&1
done
osascript -e 'tell application "Finder" to display alert "Consolidate"
message "Success!"'
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Automator-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden