Advertisement
Guest User

Untitled

a guest
Jul 17th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. # Command Line Bash - Change file date modified to date taken/created - For each file in directory - Linux/Mac
  2.  
  3. # 1. Example with all files in current directory:
  4. for f in $(ls .);do touch -t $(date -r $(stat -f%B $f) +%Y%m%d%H%M) $f;done
  5.  
  6. # 2. Example with all files in specific directory:
  7. # specific directory is for example:
  8. # /Users/adamrosloniec/Downloads/BACKUP-PHOTOS/
  9. for f in $(ls /Users/adamrosloniec/Downloads/BACKUP-PHOTOS/);do touch -t $(date -r $(stat -f%B $f) +%Y%m%d%H%M) $f;done
  10.  
  11. # 3. Example with only .jpg files in specific directory:
  12. for f in $(ls /Users/adamrosloniec/Downloads/BACKUP-PHOTOS/*.jpg);do touch -t $(date -r $(stat -f%B $f) +%Y%m%d%H%M) $f;done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement