Newsroom Update

New features come to Apple services this fall. Learn more >

Move file in Automator

I'm a noob when it comes to scripting or even automating anything, my apologies in advance. I'm trying to get automator to read the first line in a text file (it's a number) and use that input to find a photo of the same number and move it from one folder into the next. There are about 1500 jpegs in that folder and I need to find that specific one mentioned as a number in the text file.

Mac Studio (2022)

Posted on May 22, 2024 4:25 PM

Reply
4 replies

May 23, 2024 8:08 PM in response to VikingOSX

My apologies for posting in 2 forums, I just didn't know which one was more applicable to my request (First Time Here)


I was hoping it was you that would respond, went through a few of you previous post and was very impressed.


I'm currently working on a Automated Video Streaming service for a church so the staff and priest have very little to do other than to speak to god and pray for world peace (lol)


I set up an Automater where the priest will send an email with the text number of the corresponding Jpeg he wants on AIr, The automator then copies the text into the text file labelled daily.text. I have another Automator that runs with startup every morning and clears the contents of the Folder Named Daily where the copied and renamed to daily.jpeg will reside. I originally wanted to do it via text message but couldn't figure it out, so the priest said email is fine.


The Video switcher will only look for the jpeg in named daily.jpeg in the daily folder. I created a macro in the video switcher to do this automated.


  1. So the file name of the text will never change It is located in a a drive labelled Media A that also will store the folder of the Assets (All jpegs reside here) as well as the folder named Daily where the copied file ends up.
  2. The text file will only have 1 line with either a number or a number with a the letter b behind it or somelike like 739-740.
  3. The files are all jpeg's and nothing else but jpegs will be in it.
  4. The moved image file needs to be renamed Daily.jpeg
  5. The files are in a parent folder
  6. All images are on a local drive named Media A


If attached a few screenshots.


Thank You very much for your help.




May 23, 2024 7:17 AM in response to lexusplexus2014

Show an example of the number contained in the first line of that text file. Show an example JPG filename.


  • Does the name of the text file ever change? Is it co-located within the image folder or separate, and if the latter, always in the same filesystem location with the same filename?
  • You said number in the first line, but could that also be an alphanumeric string or a number embedded in other text?
  • Can there be different image types with the same name in that folder of images?
  • Will the moved image maintain the same filename, or are you renaming it in the move process?
  • Are those 1500 images in a parent folder or among several sub-folders in that parent folder?
  • Images on a local filesystem or external in a cloud or fileserver mount point?

May 23, 2024 9:11 PM in response to lexusplexus2014

It seems likely that a video streaming system has already been written and tested elsewhere, so do check around with other and larger churches and similar organizations, and see what they’re using for this and other church-related purposes.


If there are existing choices with equal or better capabilities, choosing to write your own should be approached with great caution particularly around ongoing testing and maintenance over time. That means planning for ongoing maintenance and for system and hardware updates, minimally. Large systems systems are ~never done.


Por ejemplo:

etc


And more generally, this particular case is on the edge of being better suited for a database, and keeping track of the files and the relationships there.


If these aren’t your videos, but are related to some other system or app ir package, have a look at what EXIF or other metadata is stored in the files, too. Information there can sometimes help with sorting and maintenance tasks.


A shell script wouldn’t be too difficult, but I’d tend to go to Swift or ObjC or Python, and avoid using AppleScript here. While AppleScript (or a shell script) can work, it tends to be more limited in its capabilities and tools, and whole piles of AppleScript (or shell scripts) can get fragile as they get evolved and changed and refactored over time.

Move file in Automator

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