[Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
Moderators: white, Hacker, petermad, Stefan2
[Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
Although most of the time I remember renaming and deleting files in TC, in which situation TC can handle the file<->comment bonding correctly. However, sometimes I still forget, and accidentally move the file using Ctrl-C Ctrl-V or changing the filename using other tools (not explorer, just other software).
i really hope being reminded once this happens (or other ways which can prevent this kind of mistakes from the beginning). Probably TC don't have this feature by self and i'm just asking if there's any avenue (including external ones)
a brief thought like finding(infinite loop) all descript.ion in disk using everything and parse them in turn and determine if the corresponding file exists. but coding is hard to me, so have to ask is there any ready-made tool. thanks
i really hope being reminded once this happens (or other ways which can prevent this kind of mistakes from the beginning). Probably TC don't have this feature by self and i'm just asking if there's any avenue (including external ones)
a brief thought like finding(infinite loop) all descript.ion in disk using everything and parse them in turn and determine if the corresponding file exists. but coding is hard to me, so have to ask is there any ready-made tool. thanks
Last edited by hahaha on 2018-12-16, 13:37 UTC, edited 1 time in total.
Re: Remind user once the bound file in the descript.ion disappears but the comment still exist
Configuration - Options... - Operation - File comments: ☑ Copy comments with files (press button "Help")
causes file comments to be taken into account when copying, deleting and renaming files in Total Commander.
Attention:
(1) Ctrl-C Ctrl-V or other software is not useful, because then the file comments created with/in TC are lost despite this setting in TC!
With F5 Copy in TC the file comments are retained. A file deletion causes file comment deletion at the same time.
(2) Only if you want TC file comments to be taken into account during synchronization (e.g. for asymmetric synchronization),
then you have to uncheck this setting first(!)
Option:
You can color files/folders with TC file comments (Ctrl + Z)
viewtopic.php?p=337415#337415
viewtopic.php?p=336294#336294
causes file comments to be taken into account when copying, deleting and renaming files in Total Commander.
Attention:
(1) Ctrl-C Ctrl-V or other software is not useful, because then the file comments created with/in TC are lost despite this setting in TC!
With F5 Copy in TC the file comments are retained. A file deletion causes file comment deletion at the same time.
(2) Only if you want TC file comments to be taken into account during synchronization (e.g. for asymmetric synchronization),
then you have to uncheck this setting first(!)
Option:
You can color files/folders with TC file comments (Ctrl + Z)
viewtopic.php?p=337415#337415
viewtopic.php?p=336294#336294
Re: Remind user once the bound file in the descript.ion disappears but the comment still exist
hahaha,
Here is a short AHK script that scans descript.ion files' contents for missing files and writes them to MissingFiles.txt:
And here is a functionally equivalent but much easier to understand version:
HTH
Roman
Here is a short AHK script that scans descript.ion files' contents for missing files and writes them to MissingFiles.txt:
Code: Select all
StartDir = C:\Test
Recurse = True
ResultFile = MissingFiles.txt
SetWorkingDir, %StartDir%
Loop, Files, descript.ion, % Recurse = "True" ? "R" : ""
{
FileRead, DescriptIon, %A_LoopFileName%
Loop, Parse, DescriptIon, `n, `r
{
FileName := SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2)
If (FileName != "")
If (A_LoopFileDir = "")
MissingFiles .= FileExist(FileName) = "" ? FileName . "`n" : ""
Else
MissingFiles .= FileExist(A_LoopFileDir . "\" . FileName) = "" ? A_LoopFileDir . "\" . FileName . "`n" : ""
}
}
MissingFiles := SubStr(MissingFiles, 1, -1)
FileAppend, %MissingFiles%, %ResultFile%
And here is a functionally equivalent but much easier to understand version:
Code: Select all
StartDir = C:\Test
Recurse = True
ResultFile = MissingFiles.txt
SetWorkingDir, %StartDir%
Loop, Files, descript.ion, % Recurse = "True" ? "R" : ""
{
FileRead, DescriptIon, %A_LoopFileName%
Loop, Parse, DescriptIon, `n, `r
MissingFiles .= (SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2)) != "" ? A_LoopFileDir = "" ? FileExist((SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2))) = "" ? (SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2)) . "`n" : "" : FileExist(A_LoopFileDir . "\" . (SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2))) = "" ? A_LoopFileDir . "\" . (SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2)) . "`n" : "" : ""
}
MissingFiles := SubStr(MissingFiles, 1, -1)
FileAppend, %MissingFiles%, %ResultFile%
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Remind user once the bound file in the descript.ion disappears but the comment still exist
2Hacker
The scripts don't work for me yet.
EDIT: There were only folders…
MissingFiles.txt
EDIT:
The script obviously doesn't consider subfolders at the moment but only the set path.
The file name for which a comment was created is written to the MissingFiles.txt file,
but the file has been moved or deleted and the file comment still exists in the hidden descript.ion file.
In my opinion, the script only works for file comments and not for folder comments.
The scripts don't work for me yet.
Code: Select all
StartDir = D:\Daten
MissingFiles.txt
- 726(!) x file "_2018-09-22_Total Commander-ADMINISTRATOR.png" in a lot of subdirs
- in a total of 2,176 lines
- "EDV\EXCEL" is displayed even though D:\Daten\EDV\EXCEL does not exist
- "EDV\Acrobat\EXCEL" is displayed even though folder EXCEL does not exist - I can't imagine there's ever been a combination like this.
- "EDV\Autostart\EXCEL" is displayed even though folder EXCEL does not exist
- and so on...
EDIT:
The script obviously doesn't consider subfolders at the moment but only the set path.
The file name for which a comment was created is written to the MissingFiles.txt file,
but the file has been moved or deleted and the file comment still exists in the hidden descript.ion file.
In my opinion, the script only works for file comments and not for folder comments.
Last edited by tuska on 2018-12-16, 13:39 UTC, edited 1 time in total.
Re: Remind user once the bound file in the descript.ion disappears but the comment still exist
2Hacker
Your script works for me for files in a single predefined folder path.
For me it would be very interesting if you could create an evaluation including subdirectories or for an entire drive.
In this case, the file MissingFiles.txt would need to contain the path in addition to the filenames.
Could you add this function to your script, please?
Regards
Karl
Your script works for me for files in a single predefined folder path.
For me it would be very interesting if you could create an evaluation including subdirectories or for an entire drive.
In this case, the file MissingFiles.txt would need to contain the path in addition to the filenames.
Could you add this function to your script, please?
Regards
Karl
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
tuska,
hahaha,
You're welcome. I just coded it, it's not a complex script and a small challenge is always welcome.
Roman
Umm, it's already there? Just set:it would be very interesting if you could create an evaluation including subdirectories or for an entire drive.
In this case, the file MissingFiles.txt would need to contain the path in addition to the filenames.
Code: Select all
StartDir = C:\
Recurse = True
I am not sure I understand your other issue - of course the files that don't exist are displayed, that is the point of the script, to show files which are in descript.ion but do not exist.[...] is displayed even though D:\Daten\EDV\EXCEL does not exist
hahaha,
You're welcome. I just coded it, it's not a complex script and a small challenge is always welcome.
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
2Hacker
With "spoiler" you don't see the indentations exactly like in the code...
Example:
- If I look directly in "Everything" for file "starttc.exe", then this file is present here: D:\starttc.exe (1x)! (...for a USB stick installation)
- If I filter in D:\MissingFiles.txt for file "starttc.exe", then this file appears in 867 lines in the most different folders (of 5202 lines),
i.e. under folder Bilder\*.*, Daten\*.*, TC\*.*, TomTomGo..\*.*, Videos\*.* and zTEST\2011\starttc.exe --> File with comment was never there!
- Furthermore the folder zTEST\2011\TC is listed --> this folder does not exist and has never existed there.
For me this script is currently not usable for subfolders.
Mmhh?
Can you please look at this again?
I would very much like subdirectories to work for me.
d: wfn:descript.ion in "Everything" brings up 868 entries.
This is the changed script ("Recurse = True" already existed!):
StartDir = D:\
Recurse = True
ResultFile = MissingFiles.txt
SetWorkingDir, %StartDir%
Loop, Files, descript.ion, % Recurse = "True" ? "R" : ""
{
FileRead, DescriptIon, %A_LoopFileName%
Loop, Parse, DescriptIon, `n, `r
{
FileName := SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2)
If (FileName != "")
If (A_LoopFileDir = "")
MissingFiles .= FileExist(FileName) = "" ? FileName . "`n" : ""
Else
MissingFiles .= FileExist(A_LoopFileDir . "\" . FileName) = "" ? A_LoopFileDir . "\" . FileName . "`n" : ""
}
}
MissingFiles := SubStr(MissingFiles, 1, -1)
FileAppend, %MissingFiles%, %ResultFile%
Recurse = True
ResultFile = MissingFiles.txt
SetWorkingDir, %StartDir%
Loop, Files, descript.ion, % Recurse = "True" ? "R" : ""
{
FileRead, DescriptIon, %A_LoopFileName%
Loop, Parse, DescriptIon, `n, `r
{
FileName := SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2)
If (FileName != "")
If (A_LoopFileDir = "")
MissingFiles .= FileExist(FileName) = "" ? FileName . "`n" : ""
Else
MissingFiles .= FileExist(A_LoopFileDir . "\" . FileName) = "" ? A_LoopFileDir . "\" . FileName . "`n" : ""
}
}
MissingFiles := SubStr(MissingFiles, 1, -1)
FileAppend, %MissingFiles%, %ResultFile%
Code: Select all
StartDir = D:\
Recurse = True
ResultFile = MissingFiles.txt
SetWorkingDir, %StartDir%
Loop, Files, descript.ion, % Recurse = "True" ? "R" : ""
{
FileRead, DescriptIon, %A_LoopFileName%
Loop, Parse, DescriptIon, `n, `r
{
FileName := SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2)
If (FileName != "")
If (A_LoopFileDir = "")
MissingFiles .= FileExist(FileName) = "" ? FileName . "`n" : ""
Else
MissingFiles .= FileExist(A_LoopFileDir . "\" . FileName) = "" ? A_LoopFileDir . "\" . FileName . "`n" : ""
}
}
MissingFiles := SubStr(MissingFiles, 1, -1)
FileAppend, %MissingFiles%, %ResultFile%
- If I look directly in "Everything" for file "starttc.exe", then this file is present here: D:\starttc.exe (1x)! (...for a USB stick installation)
- If I filter in D:\MissingFiles.txt for file "starttc.exe", then this file appears in 867 lines in the most different folders (of 5202 lines),
i.e. under folder Bilder\*.*, Daten\*.*, TC\*.*, TomTomGo..\*.*, Videos\*.* and zTEST\2011\starttc.exe --> File with comment was never there!
- Furthermore the folder zTEST\2011\TC is listed --> this folder does not exist and has never existed there.
For me this script is currently not usable for subfolders.
Mmhh?
Can you please look at this again?
I would very much like subdirectories to work for me.
I think I've understood the way your script works, but I don't have any programming knowledge.I am not sure I understand your other issue - of course the files that don't exist are displayed, that is the point of the script, to show files which are in descript.ion but do not exist.
Btw,The file name for which a comment was created is written to the MissingFiles.txt file,
but the file has been moved or deleted and the file comment still exists in the hidden descript.ion file.
d: wfn:descript.ion in "Everything" brings up 868 entries.
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
Wow, the Black board style works really nice!
tuska,
Can you share a ZIP of an example directory structure including descript.ion files? I guess it will be much easier to reproduce that way.
EDIT: To make sure, are you using AHK 1.1.21 or newer?
TIA
Roman
tuska,
Can you share a ZIP of an example directory structure including descript.ion files? I guess it will be much easier to reproduce that way.
EDIT: To make sure, are you using AHK 1.1.21 or newer?
TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
2Hacker
I use "AutoHotkey - Current version: v1.1.30.01 - November 11, 2018".
Please find here the folder structure and files (additionally illustrated) - please see also file zTEST.LST:
https://1drv.ms/f/s!Ah1sWOWAFm-dhh49tk48T1pSHXOl
MissingFiles.txt
Expected result
Outcome
I would like to see the entire path specified in the file "MissingFiles.txt".
Thank you!
I use "AutoHotkey - Current version: v1.1.30.01 - November 11, 2018".
Please find here the folder structure and files (additionally illustrated) - please see also file zTEST.LST:
https://1drv.ms/f/s!Ah1sWOWAFm-dhh49tk48T1pSHXOl
MissingFiles.txt
Expected result
Code: Select all
D:\zTEST\2010\Folder A\aa.txt
D:\zTEST\2010\Folder E\e.txt
D:\zTEST\2011\FolderZ
D:\zTEST\2011\Folder C\cc.txt
Code: Select all
2010\Folder A\zTEST_root.txt
2010\Folder A\2011
2010\Folder E\zTEST_root.txt
2010\Folder E\2011
2011\zTEST_root.txt
2011\2011
2011\Folder C\zTEST_root.txt
2011\Folder C\2011
2012\zTEST_root.txt
2012\2011
2012\Folder B\zTEST_root.txt
2012\Folder B\2011
2012\Folder D\zTEST_root.txt
2012\Folder D\2011
2012\Folder D\Folder X\Folder Y\zTEST_root.txt
2012\Folder D\Folder X\Folder Y\2011
Thank you!
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
tuska,
Could you please provide a ZIP file of a directory structure, including some descript.ion files, some existing files and some missing files, where you see problems?
TIA
Roman
Could you please provide a ZIP file of a directory structure, including some descript.ion files, some existing files and some missing files, where you see problems?
TIA
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
2Hacker
I used the packer plugin DiskDirExtended (*.wcx) with defined file extension: LST and created the directory structure (pls see download link above).
You can open the file zTEST.LST by pressing Ctrl+PgDn and extract the content to any folder (only the path of the script has to be changed then).
The file descript.ion then no longer has the file attribute "Hidden", but that's certainly not a drawback in this case.
The MissingFiles.txt should contain 4 entries.
However, there were 16 entries that did not match.
3 files and 1 folder which had file comments before were moved - ☐ Copy comments with files.
Please see: "D-zTEST_Dateikommentare NACH Verschiebung von Dateien und 1 Ordner.png".
-----------
Additionally I have now uploaded file zTEST.7z.
The file attribute "Hidden" was retained in the descript.ion file.
I used the packer plugin DiskDirExtended (*.wcx) with defined file extension: LST and created the directory structure (pls see download link above).
You can open the file zTEST.LST by pressing Ctrl+PgDn and extract the content to any folder (only the path of the script has to be changed then).
The file descript.ion then no longer has the file attribute "Hidden", but that's certainly not a drawback in this case.
The result I have announced above.Hacker wrote:where you see problems?
The MissingFiles.txt should contain 4 entries.
However, there were 16 entries that did not match.
3 files and 1 folder which had file comments before were moved - ☐ Copy comments with files.
Please see: "D-zTEST_Dateikommentare NACH Verschiebung von Dateien und 1 Ordner.png".
-----------
Additionally I have now uploaded file zTEST.7z.
The file attribute "Hidden" was retained in the descript.ion file.
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
tuska,
Thank you for the .7z file. Indeed, I was reading the descript.ion from the start dir over and over, for all dirs. This version should work better:
I also added an option to use absolute paths for the missing files list.
As for the results, in the .7z you provided there were no missing files, i.e. all the files mentioned in desccript.ion did really exist (there were no "orphaned" comments).
HTH
Roman
Thank you for the .7z file. Indeed, I was reading the descript.ion from the start dir over and over, for all dirs. This version should work better:
Code: Select all
StartDir = C:\Test
Recurse = True
ResultFile = MissingFiles.txt
UseAbsolutePaths = True
SetWorkingDir, %StartDir%
Loop, Files, descript.ion, % Recurse = "True" ? "R" : ""
{
FileRead, DescriptIon, %A_LoopFilePath%
Loop, Parse, DescriptIon, `n, `r
{
FileName := SubStr(A_LoopField, 1, 1) != """" ? SubStr(A_LoopField, 1, InStr(A_LoopField, " ", , 2) - 1) : SubStr(A_LoopField, 2, InStr(A_LoopField, """ ", , 2) - 2)
If (FileName != "")
If (A_LoopFileDir = "")
MissingFiles .= FileExist(FileName) = "" ? UseAbsolutePaths = "True" ? SubStr(A_LoopFileLongPath, 1, InStr(A_LoopFileLongPath, "\", , 0)) . FileName . "`n" : FileName . "`n" : ""
Else
MissingFiles .= FileExist(A_LoopFileDir . "\" . FileName) = "" ? UseAbsolutePaths = "True" ? SubStr(A_LoopFileLongPath, 1, InStr(A_LoopFileLongPath, "\", , 0)) . FileName . "`n" : A_LoopFileDir . "\" . FileName . "`n" : ""
}
}
If (MissingFiles != "")
{
MissingFiles := SubStr(MissingFiles, 1, -1)
FileAppend, %MissingFiles%, %ResultFile%
}
As for the results, in the .7z you provided there were no missing files, i.e. all the files mentioned in desccript.ion did really exist (there were no "orphaned" comments).
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
2Hacker
This script works fine for one directory as well as for subdirectories!
The test result this time was as expected (just like above: "Expected result").
I have now run the script for drive D:, with the result of 468 entries in MissingFiles.txt regarding inconsistent descript.ion files(!)
If I want to investigate the causes here, then the following results:
- In the descript.ion files there are thus orphaned data, with which in the not deleted files
(i.e. moved files) now the file comments are missing.
- I have been a TC user since 2003 and probably didn't know how to handle descript.ion files for a long time.
- In the meantime, however, I am aware of the following:
☐ Copy comments with files -> for [asymmetric] synchronizations (daily multiple backup including hidden descript.ion files!)
☑ Copy comments with files -> for files/folders with file comments during copying, renaming or deleting
Let's see what that looks like in a year when I do another query.
Thank you very much for your efforts and the perfect script!
Regards
Karl
------------
Memo
When reviewing and replacing characters with german umlauts (äöüÄÖÜ) and special characters (ß, §), the letter "ü" could not be replaced,
because it was removed from the filename.
Furthermore, a "special character" occurred with a file name, although this was not present in the file name:
D:\Daten\Programme\Adobe\Acrobat\Adobe-Acrobat-11-Pro\Preise\Preise_Adobe AcrobatÿDC.url <-> Preise_Adobe Acrobat DC.url
------------
Windows 10 Pro (x64) Version 1809 (OS Build 17763.194)
TC 9.21a x64/x86 | Everything - Version 1.4.1.923 (x64)
This script works fine for one directory as well as for subdirectories!
The test result this time was as expected (just like above: "Expected result").
Yes, unfortunately I gave you the complete folder structure with all files and folders instead of those with already moved files/folder. Sorry!Hacker wrote:As for the results, in the .7z you provided there were no missing files, i.e. all the files mentioned in desccript.ion did really exist
(there were no "orphaned" comments).
I'm very happy about that!Hacker wrote:I also added an option to use absolute paths for the missing files list.
I have now run the script for drive D:, with the result of 468 entries in MissingFiles.txt regarding inconsistent descript.ion files(!)
If I want to investigate the causes here, then the following results:
- In the descript.ion files there are thus orphaned data, with which in the not deleted files
(i.e. moved files) now the file comments are missing.
- I have been a TC user since 2003 and probably didn't know how to handle descript.ion files for a long time.
- In the meantime, however, I am aware of the following:
☐ Copy comments with files -> for [asymmetric] synchronizations (daily multiple backup including hidden descript.ion files!)
☑ Copy comments with files -> for files/folders with file comments during copying, renaming or deleting
Let's see what that looks like in a year when I do another query.
Thank you very much for your efforts and the perfect script!
Regards
Karl
------------
Memo
When reviewing and replacing characters with german umlauts (äöüÄÖÜ) and special characters (ß, §), the letter "ü" could not be replaced,
because it was removed from the filename.
Furthermore, a "special character" occurred with a file name, although this was not present in the file name:
D:\Daten\Programme\Adobe\Acrobat\Adobe-Acrobat-11-Pro\Preise\Preise_Adobe AcrobatÿDC.url <-> Preise_Adobe Acrobat DC.url
------------
Windows 10 Pro (x64) Version 1809 (OS Build 17763.194)
TC 9.21a x64/x86 | Everything - Version 1.4.1.923 (x64)
Re: [Solved] Remind user once the bound file in the descript.ion disappears but the comment still exist
tuska,
You're welcome, glad it helped.
Roman
You're welcome, glad it helped.
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.