# lua files, what are they and can they be deleted?



## stevedo (Dec 14, 2020)

I have recently started to use sync from the Lightroom camera on my Samsung phone to Lightroom Classic. I've noticed that in the "Lightroom's synced images:" in LrC that there are .lua files. I don't leave the synced photo files in the folder to which they are synced but move them to a more appropriate location (using Lightroom). This leaves behind a .lua file. Due to the fact that there is a file in the folder, when I remove the folder from within Lightroom it is not actually deleted from the file system. So, for now, I've left them where they are. I sync the files on a folder for each day basis, therefore I now have a few folders with just .lua files in them. I did rename one to see what would happen in Lightroom and did not notice any detrimental effect. I'm now at a stage where I want to clean up my sync folders i.e. delete those that just contain .lua files.

I'm really not sure if they can be safely deleted or not? Any ideas?


----------



## johnbeardy (Dec 14, 2020)

These info.lua files are added by sync to control syncing from each device, but  they have no value afterwards and get left if the folder if you move or delete the photos. As you say, they interfere with deleting those folders, but you can safely delete them.


----------



## johnbeardy (Dec 14, 2020)

Find attached a little script that I use to delete them automatically. Setup instructions are in the file.


----------



## clee01l (Dec 14, 2020)

The LUA is an embeddable scripting language used by Lightroom. The file should be plain text and readable in any text editor. I’ve never seen these associated with sync’s files and I don’t know why they would be unless the sync process needs the scripted files temporarily and would normally delete them afterward. You can delete the otherwise empty folder with the LUA files too. 
You can set LrC to automatically import to the Date named folder structure as you would for a regular import.This would eliminate the need to move them later. 


Sent from my iPad using Tapatalk


----------



## johnbeardy (Dec 14, 2020)

clee01l said:


> I’ve never seen these associated with sync’s files and I don’t know why they would be unless the sync process needs the scripted files temporarily and would normally delete them afterward.


If you set sync's download location so it organizes by date, you then see an info.lua file in each day's folder. 

It needs them temporarily but fails to delete them afterwards, so the delete folder code removes the folder rather than deletes it.


----------



## stevedo (Dec 15, 2020)

johnbeardy said:


> Find attached a little script that I use to delete them automatically. Setup instructions are in the file.



Hi John, thanks very much for confirming that the files can be safely deleted. Your script will prove to be very useful


----------



## stevedo (Dec 15, 2020)

clee01l said:


> I’ve never seen these associated with sync’s files and I don’t know why they would be unless the sync process needs the scripted files temporarily and would normally delete them afterward. You can delete the otherwise empty folder with the LUA files too.





johnbeardy said:


> If you set sync's download location so it organizes by date, you then see an info.lua file in each day's folder.
> 
> It needs them temporarily but fails to delete them afterwards, so the delete folder code removes the folder rather than deletes it.



My experience is exactly as John describes. Always get a .lua file when syncing to local folders.


----------



## johnbeardy (Dec 15, 2020)

IIRC open them in a text editor and you'll find they simply list the devices from which photos have been synced - eg Johns iPhone.


----------



## dasuess51 (Dec 15, 2020)

When I run it on my Mac it dies on line 39 with a null pointer error in getpath(). I just might have to learn a new coding language.


Sent from my iPhone using Tapatalk


----------



## johnbeardy (Dec 15, 2020)

Run it when a *folder* is selected.

The idea is that it loops through the active folders, finds any of these info.lua files, and deletes them from the folder. As I would only ever run it in a folder, I never bothered adding error handling, eg for when a collection is active.


----------



## dasuess51 (Dec 15, 2020)

johnbeardy said:


> Run it when a *folder* is selected.
> 
> The idea is that it loops through the active folders, finds any of these info.lua files, and deletes them from the folder. As I would only ever run it in a folder, I never bothered adding error handling, eg for when a collection is active.



Gotcha... still think I need to learn more about this - can’t be any harder than C, Perl and Java - right? I have downloaded all the API stuff from Adobe. Might be something to help get thru the last months of C-19.


Sent from my iPhone using Tapatalk


----------

