custom string compare?

Apr 2, 2011
1,461
10
54
North Carolina, USA
I have a MoveAll.btm - which moves all files in a folder tree to C:\Z_UserFiles\Multiedit\DEL_000\ for instance; However in debugging the moves some files ended up in the wrong folder, for instance YahooMessenger and not Multiedit. Therefore I'd like to compare the files location to where the routine "thinks" it should be. How would I compare

C:\Z_UserFiles\MultiEdit\
with

%@path[%tFile] ?

I looked at @similar but not sure what value would be the breakpoint as to if I need to actually move the file? Any thoughts?

I have attached the BTM ........
 

Attachments

  • Move_All.btm
    11.1 KB · Views: 101
Apr 13, 2010
314
7
61
The Hague
I have a hard time understanding your question, even after taking a look at your code.

I understand that you are sorting files into classes based on their extension and some additional rules. The tests should yield a target path for each file.

In order to help you, I need to understand where the custom string compare fits into you question.
 
Apr 2, 2011
1,461
10
54
North Carolina, USA
Hello djsplits

I have added some rem'ed comments to the moveall.btm - just look for "iff defined pTGT then" and the lines thereafter
 

Attachments

  • Move_All.btm
    11.7 KB · Views: 102
Apr 13, 2010
314
7
61
The Hague
1) I noticed a line "goto here" and two labels: "here" and "heere". Are these as intended?

2) For readability and disambiguity replace %pTGT% with %[pTGT]

3) This numbering scheme you are using: could you use @version[] ? If not, what is it for?

4) Now where and how does the string compare come in?
 
Apr 2, 2011
1,461
10
54
North Carolina, USA
1) I changed the outer to use :Cleanup and the inner one to use :Here

2) Should I do the same for all my % vars?

3) I don't want to replace files that already exist - that is why I use %[nNum]

4) See my two examples - search for "e.g." - around line 288
 

Attachments

  • Move_All.btm
    11.8 KB · Views: 95
Apr 13, 2010
314
7
61
The Hague
ad 3) I thought so. Could you use @version?

ad 4) You are making separate subdirs. Could you group versioned files instead? (keep files together in 1 subdir but with a number in the filename?)

And, would you be so kind to point me to the line in your code that fails? The string compare?

I also add an alternative implementation, just for fun and to keep you on your toes ;-)

DJ
 

Attachments

  • MoveAll.BTM
    1.5 KB · Views: 96
Apr 2, 2011
1,461
10
54
North Carolina, USA
re 3: since I am working with various types of files, BAT, BTM, JPG, GIF, MPG, I do not think @version would be of much use here.

re 4: I don't want to mess with the filename - just with adding subdirs

q5: And, would you be so kind to point me to the line in your code that fails? The string compare?
I am just not sure how to handle coding the compare %[TGT] and %@path[%[fn]] -

q6: I also add an alternative implementation, just for fun and to keep you on your toes ;-)
I will look at your new BTM and reply later....
 
Apr 13, 2010
314
7
61
The Hague
How about

Code:
iff %@index[%@path[%fn],%pTGT] eq -1 then
    :: The existing path is not on the target path
endiff
 
Apr 2, 2011
1,461
10
54
North Carolina, USA
@djspits sorry about the delay in responding, life has a bad habit of getting in the way sometimes. Anyway I did some additions to the MoveAll.btm - as you can see, and made one change as to where one of the file extension matches goes. I'd very much appreciate seeing what you had in mind for the rest of the code.
 

Attachments

  • Move_All.btm
    12.6 KB · Views: 101
  • MoveAll.BTM
    2.3 KB · Views: 102
Similar threads
Thread starter Title Forum Replies Date
robinsiebler Creating a custom prompt Support 9
D Custom ini-file is not read, by tcmd.exe cli Support 6
C How to? Add date/time to custom tpipe based BTM Support 1
D How to? Using a custom ini file with TCC from Take Command Support 7
mfarah How to? So I want a custom directory for the plugins... Support 16
C How to? create a JPSoft BTM menu to run custom custom batch files Support 2
W Custom colors not saved in TCC 14 / Windows 7 x64 Support 4
tinjaw Looking for best practice for custom environment on tabs Support 0
P Inserting string into a variable. Support 3
M Backquoted parameters used in GoSub don't pass string as a single parameter Support 2
H Behavior change re piping a string to a Java program Support 1
C email[string] function Support 10
D Finding a string position in a larger string Support 2
MikeBaas How to...extract a string from a .json-file? Support 10
D Faster string search Support 8
D btm file command line augments comparing for string or math. Support 12
B How can TCC make an output as a part of command string Support 2
vefatica DO /L, where did my string go? Support 6
Alpengreis A leading withespace in Hash-String is not included? Support 1
T TPipe: Replacing String with Double Quotes Support 3
J WAD utf8decode string only results in ? chars Support 2
scooter_de How to? How to split the a string? Support 4
C Best way to validate a string is a YYYYMMDD Support 7
Phileosophos Documentation TPIPE /string type code confusion Support 4
vefatica WAD "tokens=*" and literal string Support 4
vefatica Back-refs in TPIPE's /replace's replacement string? Support 2
vefatica @B64ENCODE[s,string]? Support 8
vefatica Random access to the characters in a string? Support 4
vefatica @WORD[], quoted string? Support 8
H "Here-String" redirection not working Support 6
C Can't remove leading quote from a string Support 2
R How to? Compare executables' version/build # including 123.456.789.01 Support 10
M How to? Compare file timestamps accross different file systems... Support 1
C Suggestions for Compare Folder Tree routine Support 5
MickeyF how to compare version strings Support 11
R best file compare util Support 5
deleyd Need example of @COMPARE Support 1
p.f.moore Compare 2 directories Support 8

Similar threads