• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using automator to place hundred of files in a single folder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

References: 
 >Using automator to place hundred of files in a single folder (From: Philip Giles <email@hidden>)

  • Prev by Date: Using automator to place hundred of files in a single folder
  • Next by Date: Re: Using automator to place hundred of files in a single folder
  • Previous by thread: Using automator to place hundred of files in a single folder
  • Next by thread: Re: Using automator to place hundred of files in a single folder
  • Index(es):
    • Date
    • Thread