This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
software:datetofile [2012/05/07 04:17] – [dateTofile] admin | software:datetofile [2013/02/09 21:34] (current) – [photo sorting - dateTofile] admin | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== dateTofile ====== | + | ====== |
- | This page describes a perl- and an Applescript which work together | + | This page describes a solution to help organizing files with different creation dates. It is an alternative |
+ | * file name: Img002.jpg | ||
+ | * Creation date: 23rd of Mai, 2012, 10.07.49 PM | ||
- | ===== Installation | + | After selecting the file, drag and drop it onto the applescript. Depending on the offset, the filename will be modified as follows: |
- | - Save the applescript from below to a directory. | + | |
+ | ^ Offset | ||
+ | ^ No offset | ||
+ | ^ Offset +1 hr | Img002.jpg | ||
+ | ^ Offset -1 day | Img002.jpg | ||
+ | |||
+ | When using the script directly via the terminal, the script can be invoked with the following command: | ||
+ | ./date2file [-t offset] file1 file2 ... fileN | ||
+ | where [ ] is optional.\\ \\ If it is necessary to change the date-time stamp, the script can be run again with the date-time stamped file. Instead of writing an additional date-time stamp, the current one is being replaced instead. This prevents writing double time-stamps like 20120523_230749.20120523_220749.Img002.jpg . For example: | ||
+ | ^ Original file ^ After drag and drop ^ Offset | ||
+ | | 20120523_220749.Img002.jpg | ||
+ | | 20120523_070749.Img002.jpg(((Please note that for calculating the new offset to the leading date-time stamp, still the original file creation date is being used, instead of the current leading date-time stamp.))) | ||
+ | ====== Download ====== | ||
+ | The scripts can be downloaded here: [[http:// | ||
+ | dateTofile.app/ | ||
+ | |||
+ | ====== Manual installation | ||
+ | - Save the applescript, named dateTofile, | ||
- Copy the perl script, named date2file, into the following subdirectory of the applescript directory: %%dateTofile.app/ | - Copy the perl script, named date2file, into the following subdirectory of the applescript directory: %%dateTofile.app/ | ||
- | - make the perl script executable with chmod +x date2file | + | - make the perl script executable with: |
==== Applescript - dateTofile ==== | ==== Applescript - dateTofile ==== | ||
Line 96: | Line 115: | ||
==== Perl script - date2file ==== | ==== Perl script - date2file ==== | ||
+ | The script below will add a leading date-time stamp to a filename. | ||
<code perl># | <code perl># | ||
use File:: | use File:: | ||
Line 129: | Line 149: | ||
} | } | ||
- | # open (MYFILE, '>>/ | ||
- | # print MYFILE " | ||
foreach (@ARGV) { | foreach (@ARGV) { | ||
$file_dirname = dirname($_); | $file_dirname = dirname($_); | ||
Line 155: | Line 173: | ||
$ftime = localtime($file_time)-> | $ftime = localtime($file_time)-> | ||
$file_target = File:: | $file_target = File:: | ||
- | # print " | ||
- | # print $file_target." | ||
- | # print $file_dirname." | ||
move($_, | move($_, | ||
} | } | ||
- | # close (MYFILE); | ||
</ | </ |