Add Dates To File Or Photo Names With an Automator Script

แชร์
ฝัง
  • เผยแพร่เมื่อ 14 ก.ค. 2024
  • macmost.com/e-2077 You can use a shell script inside an Automator Quick Action to add the date of a file to the beginning of the file's name. You can also make this work with photos using the date the photo was taken from the metadata in the file. As a Quick Action you can easily apply this name change to one or many files at once.
    FOLLOW MACMOST FOR NEW TUTORIALS EVERY DAY
    ▶︎ TH-cam - macmost.com/j-youtube (And hit the 🔔)
    ▶︎ Weekly Email Newsletter - macmost.com/newsletter ✉️
    ▶︎ Twitter - / rosenz and / macmost 🐦
    ▶︎ Facebook - / macmost 👍
    SUPPORT MACMOST AT PATREON
    ▶︎ macmost.com/patreon ❤️
    #macmost #automator #shellscript
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 118

  • @nidostar2013
    @nidostar2013 4 ปีที่แล้ว

    Great. This really is getting the most from your Mac. Thank you.

  • @annewilliams2985
    @annewilliams2985 4 ปีที่แล้ว

    Thank you. With a few modifications, this did exactly what I needed to finally let Aperture go

  • @omarfayyad1
    @omarfayyad1 3 ปีที่แล้ว

    Your work is the fantastic man! Keep it coming!

  • @JustRonDon
    @JustRonDon 4 ปีที่แล้ว

    Wow.. Thank you so much. I have been needing this exact solution for so long.

  • @LexSijtsma2
    @LexSijtsma2 3 ปีที่แล้ว

    This is very nice. I used to be a systems admin on Unix servers. Glad I switched from Windows to Mac.

  • @etienneb4403
    @etienneb4403 4 ปีที่แล้ว

    Great tutorial, easy to follow along

  • @ErdodyStudios
    @ErdodyStudios ปีที่แล้ว

    Lifesaver, thank you for this!

  • @tommcmullen4915
    @tommcmullen4915 3 ปีที่แล้ว

    Thankyou for this. Massive help

  • @AlergicToSnow
    @AlergicToSnow 4 ปีที่แล้ว +1

    Perfect! More, please.

  • @homemixer
    @homemixer 4 ปีที่แล้ว +1

    Thanks! That's so helpfull!!

  • @advwxyz
    @advwxyz ปีที่แล้ว

    Thank you!

  • @ric3731
    @ric3731 2 ปีที่แล้ว

    Thank you very much!!!

  • @wwkk4964
    @wwkk4964 4 ปีที่แล้ว

    thank you dear

  • @ShopTherapy623
    @ShopTherapy623 4 ปีที่แล้ว

    Wish I knew how to do this shit. Lol. Love your videos man. I'm learning a lot!

  • @geemacm
    @geemacm 3 ปีที่แล้ว +1

    Excellent, clear and concise video, have subscribed for more goodies. I'm very interested in making a version of your automator script to abstract the date/time from the exif data of when the photo was taken and add this as a text field to the image. Following your scripts I have got the date and time value I want, (reminded me of my previous involvement with the UNIX environment), but how can I use this value and add it to, say, the lower right corner of the image, using a particular size, font type and colour?

  • @DB-su5qp
    @DB-su5qp 3 ปีที่แล้ว

    this is good

  • @DuckCow2
    @DuckCow2 3 ปีที่แล้ว +3

    Great video, could you please do this for iPhone Videos, aka MPEG-4 based of the date captured

  • @TheOscarsClub
    @TheOscarsClub 3 ปีที่แล้ว

    Hi - thank you! So useful but I have a question. How can I change the formatting of the date to be delimited by full stops and followed by a dash I.e. ‘2020.12.09 - Filename’. Thanks again

  • @randhir508
    @randhir508 3 ปีที่แล้ว

    This is awesome! How would one have the date show up in YYMMDD format with the time included? So YYMMDD_HHMM_filename- EDIT. Solved.

  • @DHidG
    @DHidG ปีที่แล้ว

    Impressive! You are clear and straight! Thank you. Just one suggestion: could you put the automator commands in the video description so we can cmdC + cmdV.

    • @macmost
      @macmost  ปีที่แล้ว +1

      Just click on the link at the start of the description to go to my site and I have the code there.

    • @DHidG
      @DHidG ปีที่แล้ว

      @@macmost thanks!

  • @callejondorado
    @callejondorado 3 ปีที่แล้ว

    I just noticed differences of the "stat" command with Linux. In Mac -f means "format", in linux -f means "file system status" and "-c" is for format, in Mac you said %B is number of seconds since whatever date, in Linux "stat -c %B" is the file size in bytes.

  • @HRPS117
    @HRPS117 4 ปีที่แล้ว

    What a great script and very helpful! Thank you!
    Would it be possible cut a second script to us the "Date Time Digitized" (DTD) element of EXIF instead of the "Created By Date" (CBD)? Often, when the image file is pulled from elsewhere Apple will use the CBD date which may not be the date the picture was taken i.e. DTD. I understand the DTD is not reachable via Apple View. However if you launch Preview > Inspector> EXIF it is well presented. Thank you for your attention and consideration.

    • @macmost
      @macmost  4 ปีที่แล้ว +1

      Possibly. First step would be to try to get that EXIF data. You may need to do a shell script for that as part of your Automator workflow.

  • @callejondorado
    @callejondorado 3 ปีที่แล้ว

    If I use exiftool (I had to install it) it will give me a whole different set of metadata tag names than mdls for the same file. "exiftool -s -time:all ", and the creation dat are different for the same file.

  • @schoenbaard
    @schoenbaard ปีที่แล้ว

    This is a great video. Thank you. I've been watching many of your video's and I'm learning a lot, even though I'm already using a mac for many years. I just have one question though. When I try to use this Quick Action on photo files on an external drive, it doesn't work. It only adds an empty space in the front instead. When I place the same files on the desktop however, it does work. So it seems to be related to the fact that the photo's are located on an external hard drive. Any suggestions? Thanks.

    • @macmost
      @macmost  ปีที่แล้ว

      Perhaps something to do with the name of the drive? Or the format? Hard to say. You'd have to troubleshoot it and spend some time with it to figure it out.

  • @bevintx5440
    @bevintx5440 4 ปีที่แล้ว +1

    Thanks for this very interesting video :-). I enjoyed learning several things from it. I do have one question. In the mv command, no quotes are included around $filepath. Won't that cause problems if the path has spaces in it?
    For folks using High Sierra or older (the latest version of macOS that I can run on my older Mac), I used a Service rather than a Workflow with a Quick Action, which was added in Mojave. I don't know enough about Automator to tell whether there would be some other option to use instead of a Service.
    I also tried it with BASH and found that the version on my Mac doesn't support getting the file's tail and head in that fashion.
    GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin17
    Instead of
    filename=$f:t
    I had to use either:
    filename=$(basename "$f")
    OR
    filename=${f##*/}
    (strips off everything up to, and including, the last slash)
    Instead of filepath=$f:h
    I had to use either:
    filepath=$(dirname "$f")
    OR
    filepath=${f%/*}
    (strips off last slash and everything after it)
    I only recently discovered your channel and subscribed to it. I don't always post a comment, but I've enjoyed every one that I've watched thus far.

    • @macmost
      @macmost  4 ปีที่แล้ว +1

      Yes, in shell scripts if your path has a space you need to escape the spaces with a \ before them or use quotes around the whole thing.

  • @goofgoof3663
    @goofgoof3663 3 ปีที่แล้ว

    Hello Gary, what do I do if my files do not even list the date associated with the file? It just shows timestamps for every category including creation and modification.

  • @tamsinemily
    @tamsinemily 3 ปีที่แล้ว +1

    Hello, newbie here. Thank you so much for this tutorial. Will it work for .mov files? Can I view the metadata in Quicktime (or another App) in the same way as Preview can? Thank you

    • @macmost
      @macmost  3 ปีที่แล้ว

      I'm not sure. Try it, but the metadata will be different if it is there at all.

  • @y-an5986
    @y-an5986 ปีที่แล้ว

    Great tutorial ! But is it possible to do this reversed ? Like use a file name to edit photo exif data or file info. Like if the name of the file is February 9 2018 (or other format like 09/02/2018) use that file name to edit EXIF data

  • @callejondorado
    @callejondorado 3 ปีที่แล้ว

    $f:t and $f:h do not seem to work in my Mac, but I can change them to $(basename $f) and $(dirname $f), perhaps it is because my Mac's default shell is bash. "echo $SHELL".

  • @Evgenybabenko
    @Evgenybabenko 4 ปีที่แล้ว

    Thank for your videos Garry. Can you tell please how to solve similar task. I need to insert date in a folder name by the earliest file inside.

    • @macmost
      @macmost  4 ปีที่แล้ว

      That will just take some coding. Probably best to work in the Script Editor for it. You'd need to loop through the times for each file and find the earliest one. Then apply that in the format you like to the folder name. Not too hard if you are programmer, but if you aren't a programmer, you'll probably want to get help from one.

  • @nickturin432
    @nickturin432 4 ปีที่แล้ว

    Hello! How to open a console program with parameters in automator? Here is what I need to open in the: "dsd -i pa: 4 -o pa: 1 -fa"

  • @daveburlingame6439
    @daveburlingame6439 ปีที่แล้ว

    This worked great for me. I modified the code to also include the time from the EXIF data, but it is off by 5 hours (I believe it's adjusting the UTC and adding 5 hours for my timezone). Is there a way to make it not add those hours? For example, the time the photo was taken at 4pm (1600) but it is naming the file 2100 hours. If I can get get this nailed down I'll be able to manage my trail came photos and videos the way I want to (no extra software, but the finder).

    • @macmost
      @macmost  ปีที่แล้ว

      You'll have to do some research on how to take the date string, convert it to a date value, then add or subtract hours from it. I don't know the commands off the top of my head, but searching code sites like StackOverflow should turn up the answer.

  • @nancyelchaar5185
    @nancyelchaar5185 3 ปีที่แล้ว

    this is great, thanks! is there a way to include a location in the file name?

    • @macmost
      @macmost  3 ปีที่แล้ว

      You can play around with it, but I think that would be tougher given that locations are complex (GPS coordinates, very long place names, etc).

  • @geoffstanton8538
    @geoffstanton8538 ปีที่แล้ว

    Hey Gary - brilliant video - thank you so much! I had problems with Terminal splitting directory names with more than one word into two! But, I used the code direct into Automator and it worked a treat! I wonder, is there a way to just use the last two digits of the year instead of the full year? i.e. so the end result would be 221028_Filename.jpg instead of 20221028_Filename.jpg etc? Keep up the great work!

    • @macmost
      @macmost  ปีที่แล้ว

      Yes, probably, you just have to work out the code.

    • @geoffstanton8538
      @geoffstanton8538 ปีที่แล้ว

      @@macmost Yep! guess that's my weekend sorted then :-)

    • @marcinstefanowski
      @marcinstefanowski ปีที่แล้ว

      %y%m%d

  • @ShervinShares
    @ShervinShares 3 ปีที่แล้ว

    Can you do this on iPad?

    • @macmost
      @macmost  3 ปีที่แล้ว

      Not that I can think of. Technically there could be an app that could do this for you, but I don't know of one.

  • @hassansindi1338
    @hassansindi1338 ปีที่แล้ว +1

    Very good, thanks, I have tried to edit it to have the date and the time, but I could get it to work, could you please explain how to make the name appear like this format [year-mo-da][hr-mi-se]

    • @macmost
      @macmost  ปีที่แล้ว

      Not sure how to get it to that format off the top of my head. You'll need to do some research and work at it if you want an exact format like that.

    • @hassansindi1338
      @hassansindi1338 ปีที่แล้ว

      @@macmost thank you so much for your reply. If I want to add the time with the date what function should I write? I could not get it to work by adding simple time formated.

    • @macmost
      @macmost  ปีที่แล้ว

      @@hassansindi1338 Sorry, I wouldn't know without researching it.

  •  2 ปีที่แล้ว

    Thanks a lot. My contribution if you want separate the filename from extension: filenamewithoutextension=${filename%.*}

  • @bernardmiller7247
    @bernardmiller7247 2 ปีที่แล้ว

    Wow! You lost me about 45 seconds in and I know I’m too dumb to be able to do this. I think it does what I am looking for but don’t think I’ll manage it. For over a decade I have been taking several pictures a day, importing them to iPhoto and with each import, selecting all, pressing ‘command, shift, B’ and having every picture “named” with the date and time in seconds. It was easy to add further information if I needed it. The pictures I take are to be sent to my doctors. They know what the content is. What they need to do know is when changes occurred. It was brilliant. When Apple switched from iPhoto to Photos and I understood that Photos doesn’t do it, I decided to stick with OSs which would allow me to continue using iPhoto. Then I bought an M1 16” MacBook Pro and didn’t have that choice any more. My workaround has to be to upload my pictures to my old computer, perform the two second ‘command, shift, B’ rename, then transfer the renamed pictures to my new computer. There has to be a simpler fix.

    • @macmost
      @macmost  2 ปีที่แล้ว

      You don't need to use automator or anything just to name the photos. Just name them in the Photos app by turning on View, Metadata, Titles and now you can edit the name under and photo easily. Then when you export it should use that name.

  • @diamondbreak
    @diamondbreak 3 ปีที่แล้ว +1

    I've tried this but sometimes it does not work (it gives just a 'space' instead of a date. BTW, really great instruction I've been looking for!

    • @CeliaaRA
      @CeliaaRA 2 ปีที่แล้ว

      same here

  • @funkmaster3000
    @funkmaster3000 3 ปีที่แล้ว

    Hey, anyone knows why my script doesn't stop and keeps changing the name with new paremeter? ;)

  • @davidtmiller56
    @davidtmiller56 4 ปีที่แล้ว

    I’d like to do this within the photo app. Also like to add a watermark with date and location also in the photos app. Is this possible?

    • @macmost
      @macmost  4 ปีที่แล้ว

      Not what I'm doing in the script, no. But you can use Markup in Photos to manually add text to the photo if you like.

  • @chrisharris1329
    @chrisharris1329 6 หลายเดือนก่อน

    Hey Gary, I found this video and it is just what I was looking for. I created the Quick Action on my Mac Air and it works great! I’ve been writing old school programs for 30 yrs, no pc type programs, and I have this uncanny ability to find issues. I was renaming some pics with this QA and renamed one with a picture taken date of 9/7/2023 10:45pm Alaska Time Zone. When it renamed it had 9/8/2023 as the date. I’m in the Eastern Time Zone. Do you think the reason it made the date 9/8 is due to the system converting from Alaska to Eastern time zone?

    • @macmost
      @macmost  6 หลายเดือนก่อน

      Very possibly.

    • @chrisharris1329
      @chrisharris1329 6 หลายเดือนก่อน

      @@macmost thanks for the reply.

  • @MichaelMcck
    @MichaelMcck 2 ปีที่แล้ว +1

    Could somebody write the same for me but with videos? I knew in videos ther's no exif but however i see the date taken in inspector.

  • @kcwhat
    @kcwhat 4 ปีที่แล้ว

    Thank goodness for Keyboard Maestro. Way too much work with Automator. Good alternate way though.

  • @helmutsassenfeld8002
    @helmutsassenfeld8002 10 หลายเดือนก่อน

    Do you have a video on how to automate changing a filename to the title (of an untitled photo) because apparently iphotos will not sort my photos by filename it can only display them in a useless random order? Way too many photos to copy ech filename to the title. Maybe if I could automate a sequential date change that could be a workaround because the precise date/time of photo is not critical.

    • @macmost
      @macmost  10 หลายเดือนก่อน

      Not sure what you are looking to do. Sorting is usually by time, not filename.

    • @helmutsassenfeld8002
      @helmutsassenfeld8002 10 หลายเดือนก่อน

      thanks for your reply. Iwant these files sorted by filename not time. iPhotos apparently cannot sort by filename but it can by title. all of these files are untiled so i need a script to copy their filenames into their respective titles, giving each a title that is the same as the filename.
      Currently iphotos but these into the library or an album in a jumble and their timestamps are not relevant to the order i desire.
      Thanks
      Helmut@@macmost

  • @2ohiosisters
    @2ohiosisters 4 ปีที่แล้ว

    Sorry Gary, I'm not getting there. I tried typing in the terminal script to get date picture was taken from metadata, and can't get past first line in terminal. I keep getting "-bash" %: command not found" error. Any chance you can explain or emal/link to the working script?

    • @macmost
      @macmost  4 ปีที่แล้ว

      The script is with the post. Click on the link at the very beginning of the description.

  • @mst63th
    @mst63th ปีที่แล้ว

    How about .MOV files, is it possible to do the same approach for video files?

    • @macmost
      @macmost  ปีที่แล้ว +1

      Technically if you can get to the metadata there. Not sure what would be needed.

    • @mst63th
      @mst63th ปีที่แล้ว

      @@macmost thanks for the prompt reply. There is no creation date for the video files as we had in EXIF for photos.

  • @manuelvera9666
    @manuelvera9666 ปีที่แล้ว

    how do i save it after i make it. it keeps disappearing after i stop using it

  • @mat5124
    @mat5124 4 ปีที่แล้ว

    Hi, how does it work with .heic photos?

    • @macmost
      @macmost  4 ปีที่แล้ว

      This just changes the file names, so it really shouldn't matter what format they are. So try it and see. Experiment!

  • @jezzeljao
    @jezzeljao 3 ปีที่แล้ว

    Hi, what is the command line if I wanted to use the "Date Time Original" (in Exif) in renaming the file? I'm really confused thank you

    • @macmost
      @macmost  3 ปีที่แล้ว

      How is that different than what I show here?

    • @jezzeljao
      @jezzeljao 3 ปีที่แล้ว

      @@macmost the "date time original" only shows when I use the "exiftool" not when I use "mdls".. How would the command line change in view of this?

    • @macmost
      @macmost  3 ปีที่แล้ว

      @@jezzeljao Not sure then. Play around and experiment to see what you can find.

    • @jezzeljao
      @jezzeljao 3 ปีที่แล้ว

      @@macmost Thank you, I will then. I've subscribed to your channel, its really helpful for a new mac user like me. Looking forward to your uploads! Stay safe :)

  • @Limey2632
    @Limey2632 2 ปีที่แล้ว

    Hi, I get an error when running my automator quick action on a text file. : The action “Run Shell Script” encountered an error: “mv: rename //Users/UserName/Desktop/log issues to /2022-04-04 /Users/Username/Desktop/log issues: No such file or directory”. Do you have any idea why I might get this?

    • @macmost
      @macmost  2 ปีที่แล้ว

      Check to make the the name is right. It is easy to miss a character.

    • @brianaalexis4203
      @brianaalexis4203 ปีที่แล้ว

      I am having the same issue :( is there anyway you fixed it?

  • @leaningless
    @leaningless 2 ปีที่แล้ว

    How do I replace "-" with "."?

  • @lalolead
    @lalolead ปีที่แล้ว

    I have tried doing the rename with dates but I get an error message when I run it.
    No such file or directory for the new file with the date

    • @macmost
      @macmost  ปีที่แล้ว

      Gotta look carefully at your code and make sure that directory is exists and is exactly as you specify it.

  • @sncat
    @sncat 7 หลายเดือนก่อน

    how do I change the attributes of files in a folder? make files available for editing and deletion. My video recorder from the car has protected files, I can't work with them. Finder does not support mass modification of file attributes.

    • @macmost
      @macmost  7 หลายเดือนก่อน

      Select the folder, use File, Get Info. Change the permissions and select the ... button and Apply To Enclosed Items. Or, you can choose multiple files, File, Show Inspector (hold down Option to reveal it) and change the permissions.

    • @sncat
      @sncat 7 หลายเดือนก่อน

      @@macmost Yes! work 🙂

  • @sweetsourworld1583
    @sweetsourworld1583 ปีที่แล้ว

    very cool! but what if creation date is incorrect? for example, i believe that pics which were sent by messenger app have that changed to the sending date. Could you show how how to deal with this? my idea is to change the file names ONLY if they start with IMG, DCS etc. (whatever majority of my pics are named to) and deal with else by hand after it would put those in a separate folder but i don't know how to write this 🤷🏻‍♂️ also it would be amazing if it would put all X date pics into X date folder, every day in separate folder, and then all folders from Y month into Y month folder, and finally all months folders from Z year into Z year folder. sweeeeet

    • @macmost
      @macmost  ปีที่แล้ว

      I suppose you could alter this script to set it to any date you want, but it will take some work and programming know-how. Maybe instead just put the date in the name of the file.

  • @eugenegrewing2587
    @eugenegrewing2587 2 หลายเดือนก่อน

    It sure be nice of if we could just copy and past this script. Or download it.

    • @macmost
      @macmost  2 หลายเดือนก่อน +1

      You can. I provide the code. Click on the link at the very top of the description to go to the actual page for this tutorial. You'll find it there.

    • @eugenegrewing2587
      @eugenegrewing2587 2 หลายเดือนก่อน

      @@macmost Thank you. Found it last night after leaving this comment. Do you know of a way to do this inside Apple Photos?

    • @macmost
      @macmost  2 หลายเดือนก่อน

      @@eugenegrewing2587 Inside your Photos library? No. But what is it you are trying to do exactly? I you can change the date of a photo in the Photos app easily without using a script.

    • @eugenegrewing2587
      @eugenegrewing2587 2 หลายเดือนก่อน

      @@macmost I want to set the photo title to the date.

    • @macmost
      @macmost  2 หลายเดือนก่อน

      @@eugenegrewing2587 No way to do that. But WHY do you want that? You can already see the date. What does setting the title to the date accomplish for you?

  • @scottgodfrey221
    @scottgodfrey221 ปีที่แล้ว

    I get the following error when I run in automator “Run Shell Script” encountered an error: “mv: rename /Users/username/Desktop/Test/filename to /Users/username/Desktop/Test/2022-11-25 IMG_0001.jpeg: No such file or directory” Would you please help me resolve this issue. I have about 4,000 picture files I would like to apply this to.

    • @macmost
      @macmost  ปีที่แล้ว

      Check your paths and code carefully to make sure they are exactly right.

    • @mrkh1973
      @mrkh1973 ปีที่แล้ว

      Check @callejondorado's comment earlier. My 2016 macbook worked only with bin/zsh, the defult proposed bin-bash did't work.
      "$f:t and $f:h do not seem to work in my Mac, but I can change them to $(basename $f) and $(dirname $f), perhaps it is because my Mac's default shell is bash. "echo $SHELL"."

  • @arthurmoreno1778
    @arthurmoreno1778 2 ปีที่แล้ว

    How I put the file extension instead of the old filename?

    • @macmost
      @macmost  2 ปีที่แล้ว +1

      Not sure what you mean. Can you give an example of what you are trying to do?

    • @arthurmoreno1778
      @arthurmoreno1778 2 ปีที่แล้ว

      @@macmost Thank you Gary!
      Sure! When I just leave the new name (the date and the hour) and apply it to the photos and files, it remove the extension of this original file.
      So, I’m forced to put the new name (the date) and del old name (IMG_1385) because the old name have the extension (IMG_1385.jpg).
      The file is renamed as:
      2022-04-23 14.36.10 IMG_1385.jpg
      So, I prefer keeping with only the new name, something like this:
      2022-04-23 14.36.10.jpg
      How I do it like this? Thanks!!

    • @macmost
      @macmost  2 ปีที่แล้ว

      @@arthurmoreno1778 examine the code carefully and you should see where you can add the extension. I’m on the go today so I can’t dig into it right now, sorry.

    • @arthurmoreno1778
      @arthurmoreno1778 2 ปีที่แล้ว

      @@macmost Don’t worry, I just need the command to get the file extension only.
      Thanks for your support 😃

  • @brianaalexis4203
    @brianaalexis4203 ปีที่แล้ว

    I tried to do this, but I am having trouble saving the shell script into a quickaction. I try to have it run and it wont. An error keeps popping up.

    • @macmost
      @macmost  ปีที่แล้ว

      What is the error, exactly? Are you following along with everything I do in the video?

    • @brianaalexis4203
      @brianaalexis4203 ปีที่แล้ว

      ​@@macmost I got an error every-time I try to run the code "“mv: rename //Users/UserName/Desktop/log issues to /2022-08-12/Users/Username/Desktop/log issues: No such file or directory”. I'm not sure what i am doing wrong, I had a a bit of trouble saving the Shell as a quick action.
      I dont know if its the correct way to do it, but I went into automator then choose quick action (settings: image files, black, and finder) and then put run shell script and put the code that you provided via your website and in the video ( I wanted to tweak it a bit to only have the date, so i put $filedate.jpeg" instead of "$filedate, $filename" and I ran it and saved it. (you mentioned to do this on your website via the comments). Once I did that, I saved it again just to make sure the code was updated, I went to an image and clicked quick action and the one that ran this code, but then it gave me that error.

    • @macmost
      @macmost  ปีที่แล้ว

      ​@@brianaalexis4203​Is that your exact code? Hard to guess where you could be going wrong without seeing your exact code.

    • @brianaalexis4203
      @brianaalexis4203 ปีที่แล้ว

      @@macmost
      I tried both codes provided on your website and tweaked it a bit, let me know if they're wrong.
      Shell script for renaming by file date:
      for f in "$@"
      do
      filedate=$(date -r $(stat -f %B $f) +%Y-%m-%d);
      filename=$f:t
      filepath=$f:h
      mv $filepath/{"$filename","$filedate.jpg"}
      done
      Shell script for renaming by photo metadata date:
      for f in "$@"
      do
      filedate=$(mdls $f | grep kMDItemContentCreationDate -m 1 | awk '{print $3}');
      filename=$f:t
      filepath=$f:h
      mv $filepath/{"$filename","$filedate.jpg""}
      done
      That's all I tweaked

    • @macmost
      @macmost  ปีที่แล้ว

      @@brianaalexis4203 You have an extra quote in the mv line.