|
POST
|
movdir = r"C:\Scans"
basedir = r"C:\Links"
# Walk through all files in the directory that contains the files to copy
for root, dirs, files in os.walk(movdir):
for filename in files:
# I use absolute path, case you want to move several dirs.
old_name = os.path.join( os.path.abspath(root), filename )
# Separate base from extension
base, extension = os.path.splitext(filename)
# Initial new name
new_name = os.path.join(basedir, base, filename)
# If folder basedir/base does not exist... You don't want to create it?
if not os.path.exists(os.path.join(basedir, base)):
print os.path.join(basedir,base), "not found"
continue # Next filename
elif not os.path.exists(new_name): # folder exists, file does not
shutil.copy(old_name, new_name)
else: # folder exists, file exists as well
ii = 1
while True:
new_name = os.path.join(basedir,base, base + "_" + str(ii) + extension)
if os.path.exists(newname):
shutil.copy(old_name, new_name)
print "Copied", old_name, "as", new_name
break
ii += 1
... View more
03-24-2017
07:37 AM
|
0
|
0
|
1097
|
|
POST
|
ahhhh .... the different ways of treating nothingness! Who would of thought the concept of nothing was this difficult. I only brought up Null time values because Sean asked specifically for a vbscript and the time functions will fail if a null date is encountered....
... View more
03-24-2017
07:28 AM
|
0
|
0
|
5641
|
|
POST
|
perhaps if you want a formatted string with leading zeros ... use the show codeblock option. In any event the above vbscript code (and mine as well) will fail if NULL Date values are found and your will have to handle your logic for missing dates! CodeBlock: strDate = CDate([BirthDate]) strDay = DatePart("d", strDate) strMonth = DatePart("m", strDate) strYear = DatePart("yyyy", strDate) If strDay < 10 Then strDay = "0" & strDay End If If strMonth < 10 Then strMonth = "0" & strMonth End If FormattedDate = strYear & "/" & strMonth & "/" & strDay Bottom Window: FormattedDate sample output "2017/03/05"
... View more
03-23-2017
07:59 AM
|
1
|
9
|
5641
|
|
POST
|
It should be attached to my previous comment as an attachment?
... View more
03-20-2017
07:47 AM
|
0
|
1
|
1768
|
|
POST
|
I was looking through some old vb code today and ran across this VB6 code project from ESRI it exposes how to create a style file in ArcGIS version 8. If I am not mistaken, not much has changed with the styles since? Maybe you will find this useful....
... View more
03-17-2017
09:48 AM
|
1
|
0
|
1768
|
|
POST
|
For interpreting the binary object, you may want to contact this person esri_style_specs/specs.md at master · nyalldawson/esri_style_specs · GitHub Other than that I am not aware of any documentation on the binary specs? Ted
... View more
03-14-2017
01:43 PM
|
0
|
1
|
1768
|
|
POST
|
The style file is simply an access database. Change the extension to a mdb .... then you can access it like an ms access database. Tips for editing your style files with Microsoft Access | ArcGIS Blog <-- may help you get started Some vb code reading style files: Style Dump
... View more
03-14-2017
11:47 AM
|
0
|
3
|
1768
|
|
POST
|
Like you I thought this turned into a case where None simply does not work as expected ... I do run across that quite often when I deal with data from multiple sources and platforms .... ... It is an important distinction knowing Null from Empty String. max(None,"") #Returns blank max("Hello","") #Returns Hello Helps me quickly determine Nulls and Empty stings ....
... View more
03-13-2017
08:33 AM
|
0
|
1
|
1264
|
|
POST
|
... sorry did not convert to Python'ese '-'.join(filter(bool,(field1,""))) --- and no it is not recommended only if the trustworthy None does not work (field contains unprintable artifact values).
... View more
03-13-2017
08:07 AM
|
0
|
0
|
1264
|
|
POST
|
One of my last resort tests when nothing else seems to work is equating null to blank myfield1 = [Field1]+"" if myfield1.strip() = "" then 'This could be null' ..... "Python Nulls Strike back!"
... View more
03-10-2017
08:50 AM
|
0
|
5
|
1264
|
|
POST
|
I ran a quick test with two date fields Birthdate and Expiredate from one of my datasets ..... def FindLabel ( [BirthDate], [ExpireDate] ):
FindLabel = ""
if [BirthDate] is None:
FindLabel = "Null" + '\n'
else:
FindLabel = [BirthDate] + '\n'
if [ExpireDate] is None:
FindLabel = FindLabel + "Null2" + '\n'
else:
FindLabel = FindLabel + [ExpireDate] + '\n'
return FindLabel + "Finished Dates"
... View more
03-09-2017
09:37 AM
|
0
|
0
|
2465
|
|
POST
|
These links may assist you ... I believe %name% is reserved for model use.... arcgis desktop - How do you add file name to an attribute field? - Geographic Information Systems Stack Exchange Batch add field, calculate field as filename This model may help you as well (I have no personal experience with it).... ArcGIS Tool: Inserts file name into attribute table - Data.gov
... View more
03-01-2017
08:17 AM
|
1
|
0
|
9533
|
|
POST
|
Dan_Patterson is correct, shapefiles do not support alias names. However some folks have gotten around this issue namely in storing the alias within the host mxd file using the properties dialog or by incorporating "Metadata" which does have a field for alias and use programic means of reading meta files and returning the field's alias. Either method is not pretty!
... View more
02-23-2017
08:53 AM
|
1
|
0
|
621
|
|
POST
|
I see no reason why it would not be doable? You are able to get users name / roles and if you have a foreign key within the photo table a filterable relationship could be established or handled by code. This looked promising ... How To: Get the current user name and roles using a server object extension
... View more
02-23-2017
08:38 AM
|
0
|
0
|
873
|
|
POST
|
I do not believe there is a straight forward way of doing it... I use GeoWizards and renode and buffering to apply number of lane changes to the split point.... In your case, quickly looking at your problem... I would suggest to do as Dan Indicated and split the rail lines at each station. Hopefully each railstation has an unique ID... if not create one.... I would then buffer each rail station so that it overlaps both sides of each rail. Then use the intersection query and transfer the pertinent node/(Rail Stations) data to the segmented rail line so each rail segment (line) would have 2 nodes(stations) identified a begin station and end station ... from there it becomes a database join query to analyze .
... View more
02-14-2017
08:39 AM
|
1
|
0
|
2189
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-18-2018 09:46 AM | |
| 1 | 05-23-2018 08:30 AM | |
| 9 | 04-18-2019 07:15 AM | |
| 1 | 05-04-2016 08:15 AM | |
| 1 | 03-24-2017 01:22 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-18-2023
06:40 PM
|