Renaming Files using FSO..

Results 1 to 2 of 2

Thread: Renaming Files using FSO..

  1. #1
    Join Date
    Dec 1969

    Default Renaming Files using FSO..

    I want to be able to take files from one directory and move them to another directory using FSO. In the process of moving the files from source to destination two things will need to occur:<BR><BR>1) The names of the files need to be renamed. The source files are picture files taken from a digital camera. The camera keeps tract of the file name and increments the naming convention based on the last number of the lst picture that was taken. For instance: dcp_0001.jpg, dcp_0002.jpg etc...<BR><BR>2) I want the user to supply a starting number where by which the renaming process will begin. For instance of the user enters 5000 then the app will start renaming the photos with 5000.jpg and increment up from there, 5001.jpg, 5002.jpg etc...<BR>

  2. #2
    Join Date
    Dec 1969

    Default Won't be easy...

    There is no guarantee that FSO will bring back the original files in name order. So you might get them in the order<BR> dcp_0002.jpg<BR> dcp_0001.jpg<BR> dcp_0004.jpg<BR> dcp_0003.jpg<BR> <BR>So that means you need to first load all the source file names into an array and then sort the array.<BR><BR>Then you go through the array and MOVE the files, one at a time, doing the needed rename on the way.<BR><BR>I do see a problem with the user supplying the starting number, too. Suppose the user gives you a starting number that already exists? Or maybe a starting number lower than what exists but, by the time you get to the last picture, you are now overlapping existing numbers?<BR><BR>Fun, isn&#039;t it?<BR><BR>

Posting Permissions

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