Commits

Radu Potop committed 938d119

daterename

Comments (0)

Files changed (2)

 #!/bin/bash
-# Prepend date to filename
+# Rename files to their modification date
 
 for file in $@
 do
     if [ -f "$file" ]; then
-        date=`ls -l --time-style=long-iso "$file"|cut -f 6 -d " "`
-        mv "$file" "$date"_"$file"
+        date=`ls  --full-time "$file" |awk '{print $6, substr($7,1,8)}'|sed 'y/:/./'`
+        ext=${file#*.}
+        mv "$file" "$date"."$ext"
     fi
 done
File contents unchanged.