Issue 18903 - Document converted with Autopilot should have option to preserve file date&time
Summary: Document converted with Autopilot should have option to preserve file date&time
Status: CONFIRMED
Alias: None
Product: General
Classification: Code
Component: code (show other issues)
Version: OOo 1.1 RC3
Hardware: PC All
: P3 Trivial with 1 vote (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords: oooqa
Depends on:
Blocks:
 
Reported: 2003-09-01 18:25 UTC by mmenaz
Modified: 2013-02-07 22:32 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description mmenaz 2003-09-01 18:25:04 UTC
AutoPilot, Document Converter is used for batch conversion. This function should
generate converted documents with the same date and time of the original file.
I have a big archive of word/excel files, and I often, when browsing directory,
use the file date as an useful information (I order by date/time, or check files
with a particular date, etc.). After converting my archive, I will end with
date/time of all my documents be the same, and different from the original ->
I've lost a lot of useful information
Comment 1 thorsten.martens 2003-09-02 11:18:15 UTC
TM->BH: Please have a look, thanks !
Comment 2 utomo99 2003-09-20 05:20:53 UTC
I think we can have better solution. 
Add option at the autopilot: 
1. Preserve original date & time
2. Change to new/current date 

some people also need this option.  

Comment 3 mmenaz 2003-09-20 22:27:37 UTC
To utomo99:
An high number of options is not always a good thing. You don't have
to confuse possibility with probability (see software design
guidelines in Alan Cooper's books, www.cooper.com).
In addition, it's easy find a utility to change files date and force
them to current.
So I think that my original request is far better than a confusing
option, and if someone needs to "flat" it's date/time files to current
one (really wondering why) can use some OS utility to do so (GNU/Linux
has "touch" command).
Comment 4 mmenaz 2005-01-26 13:37:28 UTC
Any news about this topic? 2.0 is aproaching, and this will be really useful for
conversion from M$ world to the Free one, OMHO
Thanks a lot
Comment 5 hhielscher 2005-05-26 21:15:45 UTC
There is another problem: files that were binary equal before conversion are
different afterwards because they contain different dates and/or times.
(style.xml: <text:time> and <text:date>)
Comment 6 mmenaz 2005-10-18 14:09:50 UTC
I've build a python script that, at least, sets the filesystem date/time, I post
here for some other user's convenience, but should be done automatically by the
wizard, so please fix it:

#!/usr/bin/env python

""" walks through the directory tree specified  and when it founds a file of
Microsoft
    Office format or StarOffice format  that has an equivalent in the
OpenDocument format,
    set's the latter timestamp the same as the former.
    This is useful after running the "OpenOffice.org conversion wizard"
    that unfortunately sets the timestamp of the converted files to the current
    date/time (loosing this useful information)

    Copyright (c) by Paolo Veronelli  paolo.veronelli@gmail.com
                     Marco Menardi    mmenaz@mail.com

    Todo : selectable od<x> to synchronize  from command line

    This program is Free Software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License
    as published by the Free Software Foundation; either version 2
    of the License, or any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

"""
__version__="0.1"
##### hack this dict to add supports
exts={'.doc':'.odt', # Word,  Write
      '.xls':'.ods', # Excel, Calc
      '.ppt':'.odp', # PowerPoint, Impress
      '.pps':'.odp', # PowerPoint, Impress (different extension)
      '.sxw':'.odt', # Write 1.0
      '.sxc':'.ods', # Calc 1.0
      '.sxd':'.odp', # Impress 1.0
      '.sdw':'.odt', # StarWrite 1.0
      '.sdc':'.ods', # StarCalc 1.0
      '.sdd':'.odp', # StarImpress 1.0
      '.sdp':'.odp', # StarImpress 1.0 (different extension)
     }


import glob, os, stat,sys,optparse

usage='''
python odxtssynch.py <directory>

\tPerform synchronization on modification times of open office wizard converted
\tfiles %s recursively on <directory>.Default to current directory.
'''%str(exts.keys())

parser = optparse.OptionParser(usage = usage)
parser.add_option("-n", "--nonrecurse", dest="nonrecurse", action="store_false",
default=True,
   help="don't recurse down target directory")

options,args = parser.parse_args()
if not len(args): # default to '.'
  basedir='.'
elif len(args) == 1: # the target directory
  basedir = args[0]
else:
  parser.print_help()
  sys.exit(1)


for root, dirs, files in os.walk(basedir):
    for name in files:
        base, ext = os.path.splitext(name)
        if (ext in exts) or (ext.lower() in exts):
            target = os.path.join(root, base + exts[ext.lower()]) # conversion
wizard always creates lowercase ex$
            if os.path.exists(target):
                time = os.stat(os.path.join(root, name))[stat.ST_MTIME]
                os.utime(target, (time, time))
    if not options.nonrecurse:
      break
Comment 7 bettina.haberer 2010-05-21 14:43:11 UTC
To grep the issues easier via "requirements" I put the issues currently lying on
my owner to the owner "requirements".