You are not logged in.
Pages: 1
Hello, I'm running a shared network folder for a few friends, and I'm trying to keep everything organized based on a prefix system (one friend has 001 before each file, and so on), with multiple subfolders for different data types. I'm the only one able to add the files, so they send them to me to file. The problem is, I'm trying to keep a standard system to the file names so the folder prefix goes in front of the filename, and it's exhausting when you have to manually rename tons of files, so I found this program. Would it be possible to create an array in the Pascal engine that matches certain folder names to their matching prefix, and then automatically search for that folder name in a file's metadata? We've got a pretty large database already, so a system that can run for the entire folder would be ideal. Thanks for your time!
Offline
I did not understand very well what you were trying to do. Maybe if you put various examples of what you have and how to get what you want...
Meanwhile, about the use of the array, wouldn't it be possible to use the case/switch statement explained here?
http://www.den4b.com/wiki/ReNamer:Pasca … uick_guide
If this software has helped you, consider getting your pro version. :)
Offline
Thanks for the reply! I do think the Case-Switch would work, but I'm curious to see if there's any command in Pascal that can detect particular strings within lines of metadata. Also, I'm a complete stranger to Pascal and most coding in general, so I'm sorry I can't be more specific, but what I'm hoping for is an if-then conditional where if the string is found in a given file's file location metadata, a corresponding number would be inserted as a prefix to that file. I've read through the manual, but I can't see anything in there which does that.
Offline
I don't know what you try to say with "metadata" that's very generic.
With your explanation all I can imagine is something like this:
var
BasePath, Prefix: WideString;
begin
BasePath := WideExtractFilePath(FilePath);
Prefix := '';
case BasePath of:
'C:\FolderPath1\' : Prefix := '001';
'C:\FolderPath2\' : Prefix := '002';
'C:\FolderPath3\' : Prefix := '003';
end;
FileName := Prefix + FileName;
end.
If this software has helped you, consider getting your pro version. :)
Offline
That looks pretty close to what I had in mind, actually! Just one more question, and sorry for being so vague, but would that only affect files that have that exact filepath, or would it affect all files that include that path? If the former, could I add a wildcard to the end of the path? Thanks for all your help, you're a complete lifesaver.
Offline
but would that only affect files that have that exact filepath, or would it affect all files that include that path? If the former, could I add a wildcard to the end of the path?
At this way there is no possibilty to do that. They have to be exact matches.
Can you put examples of what you want to do with the wildcard?
If this software has helped you, consider getting your pro version. :)
Offline
That's a shame. What I'd like to do, is for all files that include c:\Users\501_Blah\ to have the 501 in front of their names, even if they are in folder c:\Users\501_Blah\Art\Inspiration, and same thing for files in C:\Users\501_Blah\Music. There are a ton of subfolders for each parent, and there are dozens of parents, so having to manually put them all in would not be ideal. If need be, that is possible though. Thanks again.
Offline
That's a shame. What I'd like to do, is for all files that include c:\Users\501_Blah\ to have the 501 in front of their names, even if they are in folder c:\Users\501_Blah\Art\Inspiration, and same thing for files in C:\Users\501_Blah\Music. There are a ton of subfolders for each parent, and there are dozens of parents, so having to manually put them all in would not be ideal. If need be, that is possible though. Thanks again.
I think you would better do your own pascal script. I'll can give you a hint about the 2 ways of comparing that you are interested in but you have to fill it by yourself.
var
BasePath, Prefix: WideString;
begin
BasePath := WideExtractFilePath(FilePath);
Prefix := '';
// Partial matches
if (WideTextPos('c:\Users\501_Blah\', BasePath) = 1) then Prefix := '501';
if (WideTextPos('c:\Users\501_Blah\', BasePath) = 1) then Prefix := '502';
if (WideTextPos('c:\Users\503_Blah\', BasePath) = 1) then Prefix := '503';
// Exact matches. Important not forgetting the "\" at the end of the path.
if (WideSameText('c:\Users\Music\', BasePath)) then Prefix := '504';
if (WideSameText('c:\Users\Something\', BasePath)) then Prefix := '505';
if (WideSameText('c:\Users\BlahBlah\', BasePath)) then Prefix := '506';
FileName := Prefix + FileName;
end.
Be careful if one path could match 2 conditions, because the last one willl be the one that will show up.
If this software has helped you, consider getting your pro version. :)
Offline
No, thank you so much. You've really given me some good ideas on how to do this script right!
Offline
Pages: 1