0

I am trying to write a script for my own needs, which I will search for only graphic files in a specific folder. Then I will perform a loop with actions on each of these files. I have a problem because when the file name has a space it does not work (without spaces works fine).

for file in "/Users/user1/Documents/some folder"/*.jpg; do

What am I doing wrong?

EDIT: for me the solution was move slash at the end of the directory path. I modified a little bit my script and the working version is:

#!/bin/bash

dir="/Users/user1/Documents/some folder/"
fixedDate="07/21/2012" #mm/dd/yy
fileType="*.jpeg"

for file in "$dir"$fileType; do
    echo file:"$file"
    justTime=$(GetFileInfo -d "${file}" | cut -d ' ' -f2)
    echo justtime:$justTime
    newDate="$fixedDate "$justTime
    echo newDate:$newDate
    SetFile -d "$newDate" "${file}"
done
toma
  • 3
  • 2

0 Answers0