Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Check if model file exists

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
H.echeva
632 Views, 4 Replies

Check if model file exists

Hello all,

I am creating a macro that batch upload models to the Revit server. But I want to skip files that already exist on the Revit Server. I am trying to check with BasicFileInfo.Extract(path) and then check if is null and encapsulate in a try-catch in case the file doesn't exist. But this is not working. 

Is there an easier way to do this? 

Many thanks

4 REPLIES 4
Message 2 of 5
recepagah12
in reply to: H.echeva

Can't you simply get all file names(Include that exist in the server) and compare them with the name of files that already exist in the server. This looks like a simple comparison test.

Message 3 of 5
H.echeva
in reply to: recepagah12

the problem is that as it is in the Revit server normal Windows system methods don't work. For example I can't get the files in the server with "GetFiles" or "File.Exist". If this was done locally in our file based server it would be very easy.

Message 4 of 5
recepagah12
in reply to: H.echeva

What do you mean exactly with "Server", is it BIM360, an external database or your company's local database?

I don't get it, how you can upload a file but can't get the information of uploaded files? If everything seems impossible for now, I can suggest you create a log file that contains every information(Path, name etc.) obtained by BasicFileInfo and save it to log file. This solution is applicable even you can't get the name of the fille in the server.

Hope that helps,

Recep.

Tags (2)
Message 5 of 5
H.echeva
in reply to: recepagah12

Hello,

Yes I guess I could create a txt external file with all the uploaded files and then compare with that list. That would work. thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Forma Design Contest


Rail Community