Question

Change name of Shapefile and copy or move to another directory

  • 17 June 2021
  • 2 replies
  • 11 views

Badge +5

Hi,

I've got scripts set up to download 51 zipped up shapefiles to a directory, then extract them to another directory. There is a script to delete the old files as well so that it doesn't get out of hand. However, my source is now appending the date to the shapefile. My script expects the name to not have dates attached to it. I've used the FilenamePartExtractor and AttributeCreator to change the filename to the desired name that will work with the conversion script of shapefile to EGDB. My problem is that I can't get filecopy writer to copy or move these files to a new directory so that they can be used by the conversion script. I'm not sure what I'm missing. I've used the filecopy before for a single json file, never for many files that are related (shapefile has 8 components in this case), but this time it is being very picky. I'm thinking it has to do with the 8 files rather than 1. In the StringConcatenator, I see the name that I want and the filecopy is set up to go to the new directory. Argh!

Thanks!


2 replies

Userlevel 6
Badge +32

Check if you have you FileCopy format attributes correct. It should be

  • filecopy_source_dataset
  • filecopy_dest_dataset
  • filecopy_dest_filename

In an earlier version of the documentation one of these contained an extra space, so when copy pasted from documentation it wouldn't work...

 

As an alternative you can use a SystemCaller and use MOVE do rename and move and rename in one go. I often find this easier to set up.

Badge +5

System Caller with Move would likely work if the name of the files stayed the same all the time. However, they include the date of each run in the name of the file, so I need to truncate the name to the base part of it. I.E. Zoning_2021_06_01 becomes Zoning with the attendant filetypes. It is only the filecopy that isn't doing what I expect it to do. Again, it may be due to it having 8 files to process, but it says that 8 features came into it, and that it wrote 8 features, just nothing is being put in the directory. And I can't find where it is writing the files if it is at all. It's not a permissions issue either, the final user and I are admins on the server and have full control on these directories - just checked.

This is the script that I am using.

Thanks,

Lorinda

Reply