Importing files when a file may not exist
Forums
I have written a script to import multiple files into IDEA each month. However, there are times when some of the files I've included in my script are not available in the source location. Is there a way to write the script to skip these files if they are not in the source location?
Brian, thank you for the
Brian, thank you for the quick response. Sorry for my lack of scripting knowledge, but is there a way to do this so it doesn't pop up a message box? I'd like it to just import the file if it exists and skip the import function if the file doesn't exist.
To add to this, once the files are imported, I have a function to append the databases. However, I need to come up with a way to write the script so if one of those files did not exist, the append function will skip that file.
Brian, I haven't gotten
Brian, I haven't gotten around to working on this in a couple months, but I realized that while the code you helped me with to import files worked perfectly, I forgot to follow up on the part about appending databases.
So I've gotten it to import files if they exist. What would the code look like to append the databases that were imported, considering that there will be times when it may not import all the files included in the initial script since they may not exist?
Sure, all you have to do is
Sure, all you have to do is check to see if the file exists before doing the import. Here is an example for you. The function will return true if the file exists and false if it doesn't. If you don't include the path information the it will look for the file in the project folder, if the files are stores somewhere else then include the path info.