# Multiple initialization of files with different extensions

**URL:** <https://swi-prolog.discourse.group/t/multiple-initialization-of-files-with-different-extensions/7459>\
**Category:** General\
**Created:** [May 19, 2024, 12:30am UTC](https://swi-prolog.discourse.group/t/multiple-initialization-of-files-with-different-extensions/7459 "2024-05-19T00:30:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssardina](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/ssardina/32/189_2.png) [@ssardina](https://swi-prolog.discourse.group/u/ssardina)\
**Post date:** [May 19, 2024, 12:30am UTC](https://swi-prolog.discourse.group/t/multiple-initialization-of-files-with-different-extensions/7459/1 "2024-05-19T00:30:18Z")

</div>

We know we can start SWI and initi/load/consult many files at once:

```shell
$ swipl file1.pl file2.pl file3.pl ....

```

However, if for some reasons the files have different extensions (e.g., come from ASP code, but still plain LP) it does not work (note extensions of files):

```shell
$ swipl file1.lp file2.lp

```

will load the FIRST one (here `file1.lp`) but nothing on the second file will be loaded.

Is this the expected behavior?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [May 19, 2024, 7:14am UTC](https://swi-prolog.discourse.group/t/multiple-initialization-of-files-with-different-extensions/7459/2 "2024-05-19T07:14:51Z")

</div>

> [@ssardina](#):
>
> Is this the expected behavior?

It has been intended to work that way. The idea is that you need at least one file to load. This also make `#!/usr/bin/env swipl` work regardless of the extension. Anything that follows are application arguments. You can of course make sure that the first line starts the application and loads the `*.lp` files that follow.

---

<div class="post-metadata">

**Author:** ![ssardina](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/ssardina/32/189_2.png) [@ssardina](https://swi-prolog.discourse.group/u/ssardina)\
**Post date:** [May 19, 2024, 10:09am UTC](https://swi-prolog.discourse.group/t/multiple-initialization-of-files-with-different-extensions/7459/3 "2024-05-19T10:09:01Z")

</div>

I see. So the non `.pl` files are treated as _arguments_, not as Prolog files. Makes sense. I can make my Prolog file to see if arguments (files her) were given and in this case consult them.

Thanks, got it!
