Hi,
I wish if there is a better way when it comes to change a path of tagged items.
Let's say that I decided to change the drive letter of external drive to a new one though I have tagged items assigned to the old letter.
Or I accidentally rename a folder via windows explorer.
I believe that there is a better way to make the job done instead of the current way. Something like a dialog window where you put the old path and the new one and make Xyplorer update the database automatically.
What do you think?
Better way dealing with changing tagged item path
-
- Posts: 158
- Joined: 20 May 2011 14:34
Re: Better way dealing with changing tagged item path
Drive serials are an option for the tag database...Let's say that I decided to change the drive letter of external drive to a new one though I have tagged items assigned to the old letter.
Can be done via simple scripting (already)...I believe that there is a better way to make the job done instead of the current way. Something like a dialog window where you put the old path and the new one and make Xyplorer update the database automatically.
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 158
- Joined: 20 May 2011 14:34
Re: Better way dealing with changing tagged item path
Sorry, I have missed this optionDrive serials are an option for the tag database...
Where I can find such a script?Can be done via simple scripting (already)...
Re: Better way dealing with changing tagged item path
Code: Select all
// Replace a drive letter in the tag.dat database with a new one
$old = recase(trim(input("Enter the old drive letter..."), ":\", "R"), "U");
$new = recase(trim(input("Enter the new drive letter..."), ":\", "R"), "U");
$tags = readfile("<xydata>\tag.dat");
writefile("<xydata>\tag.dat", regexreplace($tags, "^$old:\\", "$new:\"));
#887;
echo "Tag database modified!";
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 158
- Joined: 20 May 2011 14:34
Re: Better way dealing with changing tagged item path
What if the full path have been changed via windows explorer, like "D:\My files\here is my tag" become "D:\My tag is here"highend wrote:Code: Select all
// Replace a drive letter in the tag.dat database with a new one $old = recase(trim(input("Enter the old drive letter..."), ":\", "R"), "U"); $new = recase(trim(input("Enter the new drive letter..."), ":\", "R"), "U"); $tags = readfile("<xydata>\tag.dat"); writefile("<xydata>\tag.dat", regexreplace($tags, "^$old:\\", "$new:\")); #887; echo "Tag database modified!";
Re: Better way dealing with changing tagged item path
1. All entries in the tag.dat file are case-sensitive so please enter your values correctly!What if the full path have been changed via windows explorer, like "D:\My files\here is my tag" become "D:\My tag is here"
E.g. you enter:
D:\my files\here is my tag
but the correct path name is
D:\My files\here is my tag
it would NOT work!
2. If you substitute paths, make sure you write them with a trailing backslash!
Let's say you have these entries in tag.dat
D:\Subfolder\123\pagefile.sys|0|some tag||||||
D:\Subfolder\123456\pagefile.sys|0|another tag||||||
and you want the first one to change to
E:\abc\pagefile.sys|0|some tag||||||
Then do NOT use
D:\Subfolder\123
E:\abc
but
D:\Subfolder\123\
E:\abc\
otherwise
D:\Subfolder\123456\pagefile.sys|0|another tag||||||
would change to
E:\abc456\pagefile.sys|0|another tag||||||
Code: Select all
// Replace a path in the tag.dat database with a new one
$old = input("Enter the old path...", "ATTENTION: This is case-sensitive!");
$new = input("Enter the new path...", "ATTENTION: This is case-sensitive!");
$regex = regexreplace($old, "([\\.+(){\[^$])", "\$1");
$tags = readfile("<xydata>\tag.dat");
writefile("<xydata>\tag.dat", regexreplace($tags, "^" . $regex, $new, 1));
#887;
echo "Tag database modified!";
One of my scripts helped you out? Please donate via Paypal
-
- Posts: 158
- Joined: 20 May 2011 14:34
Re: Better way dealing with changing tagged item path
Really, I can't thank you enough.