Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. for f in ~/Desktop/*; do
  2. old=$(stat -f %B -t %s "$f")
  3. touch -t $(date -r $(($old - 1234567)) +%Y%m%d%H%M%S) "$f"
  4. done
  5.  
  6. for f in ~/Desktop/*; do
  7. old=$(stat -f %B -t %s "$f")
  8. new=$(date -r $(($old + 1234567)) '+%m/%d/%Y %H:%M:%S')
  9. SetFile -d "$new" -m "$new" "$f"
  10. done
  11.  
  12. ref_file=GOPR3440.MP4
  13. new_time_for_that_file=0327160015 #date's format: 27th March 2015, 16:00
  14.  
  15. ref_file_timestamp=`stat -f %B -t %s "$ref_file"`
  16. new_time_timestamp=`date -j $new_time_for_that_file +%s`
  17. time_diff=$[$new_time_timestamp - $ref_file_timestamp]
  18.  
  19. for f in *; do
  20. old=$(stat -f %B -t %s "$f")
  21. new=$(date -r $(($old + $time_diff)) '+%m/%d/%Y %H:%M:%S')
  22. SetFile -d "$new" -m "$new" "$f"
  23. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement