Better way dealing with changing tagged item path

Features wanted...
Post Reply
karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Better way dealing with changing tagged item path

Post by karimmaster101 »

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?

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Better way dealing with changing tagged item path

Post by highend »

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.
Drive serials are an option for the tag database...
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.
Can be done via simple scripting (already)...
One of my scripts helped you out? Please donate via Paypal

karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Re: Better way dealing with changing tagged item path

Post by karimmaster101 »

Drive serials are an option for the tag database...
Sorry, I have missed this option
Can be done via simple scripting (already)...
Where I can find such a script?

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Better way dealing with changing tagged item path

Post by highend »

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

karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Re: Better way dealing with changing tagged item path

Post by karimmaster101 »

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!";
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
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: Better way dealing with changing tagged item path

Post by highend »

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"
1. All entries in the tag.dat file are case-sensitive so please enter your values correctly!
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

karimmaster101
Posts: 158
Joined: 20 May 2011 14:34

Re: Better way dealing with changing tagged item path

Post by karimmaster101 »

Really, I can't thank you enough.

Post Reply