Results 1 to 9 of 9
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Rename files and place in another folder (2000)

    Hi,

    I have images files and pdf files stored within a table of the database.

    I need to copy this files into another folder labelled 'Web Updates' for example. The original needs to stay there and the new copy needs to be renamed with the field value of 'PropertyID' and the extension for that file needs preserving.

    For each record, there will be upto 12 images files and one pdf file at the most.

    Any suggestions / ideas?
    Best Regards,

    Luke

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Rename files and place in another folder (2000)

    You can use the FileCopy instruction to copy a file.

    If you want more help, please provide sufficient information.

  3. #3
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rename files and place in another folder (2000)

    Okay, sorry for my vagueness.

    I am in the process of developing our database to feed a property portal in the UK.

    We store images for property's as file locations within the database, which is then displayed with an image control on the actual database.

    Our method of saving photos / pdf's, etc is by the property address and a bit of an explanation as to what it is. For example "123 Test Avenue - Front800.jpg" This method of saving the photos is not compatible with the portal and they will require the file name to be based upon a unique idenitifier.

    We are going to use the 'PropertyID' field of the table that contains this information that we are to export. So this image would be labelled "213_00.jpg" and so on upto 213_12.jpg".

    The idea would be that upon a command button click, the code would use the results of a query to rename move and rename the images contained with the database fields "rm00 - rm12" preserving the file extension. It would also move and rename three other objects at the most, one being a PDF file.

    The folder that these images, etc will then need to be zipped and FTP'd to the portal.
    Best Regards,

    Luke

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Rename files and place in another folder (2000)

    Is "rm00 - rm12" one field, or are there 13 fields rm00, rm01, ..., rm13.
    And what exactly does "three other objects at the most, one being a PDF file" mean? You cannot say in code "rename a file, or perhaps two, or maybe three, and one of them could be a PDF file".
    Without clear, precise and sufficient information it is impossible to help.

  5. #5
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rename files and place in another folder (2000)

    rm00 - rm12 are individual fields. rm00 is going to be the only field that will always have a picture file location in. the others rm01 - rm12 may all be used, or only some of them. They are used for internal photos of property's.

    rm13 - rm14 are two pictures that will always exist as theyc ontain the file path for the energy graphs for a property.

    rm15 will 99% of the time always have a file path in as this will contain the full pdf brochure of the property.
    Best Regards,

    Luke

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Rename files and place in another folder (2000)

    OK, that's clearer.
    Do the values of rm00 ... rm15 include the path of the files, or just the file names? If the latter, are all files stored in the same folder?

  7. #7
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rename files and place in another folder (2000)

    The values are stored as full paths of the file locations. However it bases it upon a mapped drives that are consistant for every machine across the network.
    Best Regards,

    Luke

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Rename files and place in another folder (2000)

    Try the code in the attached text file. You need to set a reference to the Microsoft DAO 3.6 Object Library for it to work, and you must change the constants at the beginning of the code to match your situation.
    Attached Files Attached Files

  9. #9
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Rename files and place in another folder (2000)

    Thanks, will look at this tomorrow, eyes getting very bleary now.
    Best Regards,

    Luke

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •