ZTree.com  | ZEN  | About...  

 Index   Back

[Notice] example: take distinction from directory 2 levels above   [Notice]

By: Hartmut Schneider     Germany  
Date: Nov 11,2014 at 12:32

Here's a neat example what can be made possible.

In the current project, there are many testcase directories, e.g.
"Balise_1"
"Balise_2"
"Balise_3"
"Balise_4"
etc.
The source files of interest are located one level below the distinct directories,
e.g. Balise_1\specs\test_ctrl.rts , and are ALL named "test_ctrl.rts".

I wanted to save all source files with a leading directory distinction.
Due to the subdir, I cannot use ZTree's %n.%e variables, as they all are named "specs".

Here's a solution that works.  It uses the Windows standard command FOR /D
("If set contains wildcards, then specifies to match against directory names instead of file names.")


Left pane on parent dir, right pane on saved-files destination.  From left pane,
go e[X]ecute and launch
FOR /D %%f in (*) do COPY %%f\specs\test_ctrl.rts %j1\%%f__test_ctrl.rts

Result:  see right pane
[image]

Note: %f can be lower-letter, as it's not a ZTree batch parameter.

Works as well in Alt-Batch:  Enter left FW, open Alt-Batch and enter
FOR /D %%%f in (*) do COPY  %%%f\specs\test_ctrl.rts  %j1\%%%f__test_ctrl.rts !! pause

Regards,
Hartmut

1,449 views      
Thread locked
 

Messages in this Thread

 
96,637 Postings in 12,231 Threads, 350 registered users, 104 users online (1 registered, 103 guests)
Index | Admin contact |   Forum Time: Mar 29, 2024 - 3:40 pm UTC  |  Hits:62,411,428  (26,214 Today )
RSS Feed