I have created a simple tool which finds all properties that lay within a polygon feature (select layer by location), and then exports to a filegeodatabase (Feature class to feature class).
I am wondering if I can get the output filename to be dynamic, and include today's date in the feature class filename each time it is run?
Currently it exports LandParcelRateParking, if I run it each week it simply overwrites last weeks table. Can I get it to append to the filename to be something like:
LandParcelRateParking05042019
LandParcelRateParking09042019
etc
The model is as per below screenshot:
I am guessing there is something I can do to append the date, but I am missing it....
Cheers
Solved! Go to Solution.
Thanks for the help. This thread provided the needed solution. The inline variable referencing the calculated variable was what i wasn't getting before.
Thanks again:)
Great! Also see: Formatting date as string from user input date value in ModelBuilder
Hello All
I am trying to create zip file with name and current date.
example: Land_01242022.zip
I created shapefile with current date like this Land_todayDate.shp.
But I am having problem to have same format for zip file with all shapefile on it.
I want something like this :
Land_todaydate.zip
I have this code but this just create zip file with name and not adding date to it.
Expression:
zipshape(r"Path","Name")
this function requires the two inputs folder (path to the shapefile) and name (shapefilename, for example if your shapefile is foo.shp, the name should be foo (without the extension). it doesn't work with one input.
code Block:
import os
import glob
import zipfile
def zipshape(folder, name):
os.chdir(folder)
zipname = name + ".zip"
flist = glob.glob(name + "*")
with zipfile.ZipFile(zipname, "w") as newzip:
for ff in flist:
if ff[-4:] != "lock" and ff != zipname:
newzip.write(ff)
return os.path.join(folder, zipname)
Date Type
File
I need to run this everyday because I need to add date or maybe just overwrite pervious zip file with new date.