|
Replies:
17
-
Pages:
2
[
1
2
| Next
]
-
Last Post:
8 May 25, 23:01
Last Post By: RobM
|
|
|
Posts:
761
Registered:
13-Apr-2006
|
|
|
|
Tool to find obsolete files in the source folders?
Posted:
8 May 25, 07:24
|
|
|
|
Hi Rob (aka the master of jAlbum tools <g>)
would it be possible (for you) to create a tool which searches for files in the source folders of a project which are no longer in use and write the file names to the console?
This would make it possible to create a batch file (in Windows) to delete these files.
We all know that once in a while users (also myself) delete objects outside from jAlbum which leaves files behind which are no longer needed. Its not to save some bytes of disc space but to keep a clean file system. I for myself look into .info files etc. from time to time to search or even edit things outside from jAlbum because is much easier if thousands of files are involved.
As an example.
- Delete the file "..\JAlbum\Samples\Sample Project\Nature\diana-parkhouse-2.jpg" when jAlbum is closed.
- The file "..\JAlbum\Samples\Sample Project\Nature\.jalbum\diana-parkhouse-2.jpg.info" will remain as an orphan file.
The goal of the tool should be to find the file "..\JAlbum\Samples\Sample Project\Nature\.jalbum\diana-parkhouse-2.jpg.info".
Thanks in advance, Markus
|
|
|
Posts:
3,947
Registered:
4-Aug-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 09:08
in response to: MarkusD
|
|
|
First, in principle it’s a bad thing to delete files outside of jAlbum. Have you tried searching the root folder of a project with the preference setting ‘Index album objects’ selected?
https://jalbum.net/help/en/jAlbum/Preferences#Search
That will find all files by name or extension.
If that doesn’t work for you I’ll have a look at what’s involved in scripting it.
|
|
|
Posts:
8,096
Registered:
31-Jan-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 13:16
in response to: RobM
|
|
|
If that doesn’t work for you I’ll have a look at what’s involved in scripting it.
Shouldn't be too tough to compare the entries in albumfiles.txt to the .info files.
But wading into cache would be a mess. Not sure what Laza does, but I know that in my skins, I make use of the DiskCache() method to stash things there like background music files, font files, background image files, and so on, none of which would appear in the other jAlbum control files (other than appearing as one-liners in the .jap files).
|
|
|
Posts:
3,947
Registered:
4-Aug-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 14:44
in response to: JeffTucker
|
|
|
If that doesn’t work for you I’ll have a look at what’s involved in scripting it.
Shouldn't be too tough to compare the entries in albumfiles.txt to the .info files.
But wading into cache would be a mess. Not sure what Laza does, but I know that in my skins, I make use of the DiskCache() method to stash things there like background music files, font files, background image files, and so on, none of which would appear in the other jAlbum control files (other than appearing as one-liners in the .jap files).
I’m hoping that the project tree still has an albumObject for the missing files, then I can check if the object’s file exists and if not delete the object, which should delete all of the associated files as well as the entry in albumfiles.txt.
Been out for lunch and now going shopping, so it will have to be tonight at the earliest.
|
|
|
Posts:
761
Registered:
13-Apr-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 18:31
in response to: RobM
|
|
|
First, in principle it’s a bad thing to delete files outside of jAlbum.
I know.
I'm not sure if this is a misunderstanding. I don't know what to search for.
If that doesn’t work for you I’ll have a look at what’s involved in scripting it.
Maybe I wasn't clear enough about what I'm after.
In my original example there is one file left, the .info file. I couldn't think of how to search for that file, not from within jAlbum nor outside. Only by comparing the files (pictures, videos etc.) which are actively part of the album and the corresponding .info files.
.info files without a „partner“ are obsolete.
Thanks, Markus
|
|
|
Posts:
761
Registered:
13-Apr-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 18:32
in response to: JeffTucker
|
|
|
If that doesn’t work for you I’ll have a look at what’s involved in scripting it.
Shouldn't be too tough to compare the entries in albumfiles.txt to the .info files.
That sound like a good start.
But wading into cache would be a mess. Not sure what Laza does, but I know that in my skins, I make use of the DiskCache() method to stash things there like background music files, font files, background image files, and so on, none of which would appear in the other jAlbum control files (other than appearing as one-liners in the .jap files).
I agree, trying to also find obsolete cache files could end up in a disaster.
Thanks, Markus
|
|
|
Posts:
761
Registered:
13-Apr-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 18:36
in response to: RobM
|
|
|
If that doesn’t work for you I’ll have a look at what’s involved in scripting it.
Shouldn't be too tough to compare the entries in albumfiles.txt to the .info files.
But wading into cache would be a mess. Not sure what Laza does, but I know that in my skins, I make use of the DiskCache() method to stash things there like background music files, font files, background image files, and so on, none of which would appear in the other jAlbum control files (other than appearing as one-liners in the .jap files).
I’m hoping that the project tree still has an albumObject for the missing files, then I can check if the object’s file exists and if not delete the object, which should delete all of the associated files as well as the entry in albumfiles.txt.
Just to make that clear, the tool should not delete the files which are obsolete. Or, at least not by default.  For a start just a list of the files would be fine. So one has the chance to evaluate if the found files are really obsolete.
Been out for lunch and now going shopping, so it will have to be tonight at the earliest.
There is definitely no hurry in this matter.
Take your time.
Thanks again. Markus
|
|
|
Posts:
3,706
Registered:
18-Oct-2002
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 19:33
in response to: MarkusD
|
|
|
|
Is this tool supposed to be used in case you've deleted images OUTSIDE of jAlbum and are left with various jAlbum specific files under the ".jalbum" folder? Such a cleanup-tool can be made, but isn't it better to simply delete files from within jAlbum?
|
|
|
Posts:
761
Registered:
13-Apr-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 19:57
in response to: davidekholm
|
|
|
Is this tool supposed to be used in case you've deleted images OUTSIDE of jAlbum and are left with various jAlbum specific files under the ".jalbum" folder?
Exactly.
Such a cleanup-tool can be made, but isn't it better to simply delete files from within jAlbum?
David, we all know that it's better not to delete files outside of jAlbum. But that's the theory, the reality is different.
Some of my albums are more than 20 years old, so I'm pretty sure that I've a lot of old stuff lurking around.
Thanks, Markus
|
|
|
Posts:
761
Registered:
13-Apr-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 20:17
in response to: davidekholm
|
|
|
Thanks David,
the console gives me:
skin property 'use360Player' difference: 'false' vs 'true'
0,008s ==> null
I compiled the album and run the script again. The result in the console:
0,008s ==> null
I think I have done something wrong.
|
|
|
Posts:
3,706
Registered:
18-Oct-2002
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 20:19
in response to: MarkusD
|
|
|
I compiled the album and run the script again. The result in the console:
0,008s ==> null
I think I have done something wrong.
Looks like no stale files then
|
|
|
Posts:
761
Registered:
13-Apr-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 20:25
in response to: davidekholm
|
|
|
Looks like no stale files then
You are right, in the sampe album not all pictures have .info files!
Not I got:
D:\Eigene Dateien\MDr�ck\Pictures\JAlbum\Samples\Sample Project\Nature\.jalbum\diana-parkhouse-2.jpg.info
0,017s ==> null
I'll try it on one of my own projects.
|
|
|
Posts:
761
Registered:
13-Apr-2006
|
|
|
|
Re: Tool to find obsolete files in the source folders?
Posted:
8 May 25, 20:34
in response to: davidekholm
|
|
|
Here's an updated version of the script that also list stale cache files. Note that it will also list cache files that have been added by skin scripts:
As Jeff said, the cache files are a mine field. By looking at two out of ca. 4,000 stale cache files I saw that these cache files are the "screenshots" for the thumbs of videos. Deleting them would be wrong. 
|
|
|
|
Legend
|
|
Forum admins
|
|
Helpful Answer
|
|
Correct Answer
|
|