batch file - How to zip all sub folders inside folder with a specific name -


I want to find all the folders under the name "logfile" inside a slightly different folder structure. For example how do I find the logfile folder inside C: \ ECU \ ECU1 \ Logfile, C: \ ECU \ ECU2 \ Logfile, C: \ ECU \ ECU3 \ Logfile and C: \ ECU \ ECU4 \ Logfile? I then want to zip the .txt contents of this folder in each case. I currently have a batch file that allows me to zip the contents of a folder, which has the same folder structure every time, but the above versions all need to be combined together. Any help would be great ...

Thanks.

@echo push push "C: \ ECU \ ECU2" || Goto: Zip for all files in the EUREMEM backup directory for %% A in (*. TXT *, * .cpi *) "C: \ Program Files \ WinRAR \ WinRAR.exe" a -r "%% ~ nA" Zip "" %% A "FOR %% A IN (*. TXT, * .cpi) DO DEL" C: \ ECU \ ECU2.cpi * "" %% A "popped

Try this first test to see if it prints the correct folders:

< Pre> @echo break / d / r "c: \ ecu" %% a in (target *) (if / i "%% ~ nxa" == "target" (echo "%% a") ) Prevent it

And if it's okay, then it works A. - Test it with dummy files, but your DEL command is strange in the first term. I have replaced it, which can work.

  @ Echo off for / d / r "c: \ ecu" %% a in (target *) (if / i "%% ~ nxa" == "target" (push "%% A" REM all files backed up to the directory In %% A in (for * .txt * * .cpi *) "C: \ Program Files \ WinRAR \ WinRAR.exe" A -r "%% ~ nA.zip" "%% A" FOR %% A IN (*. TXT * .cpi) DO DEL "%% A" Poppy))  

Comments

Popular posts from this blog

c# - Process.Kill() returns access denied -

c# - NewtonSoft JArray - how to select multiple elements with LINQ -

c# - Using the generic type 'System.Collections.Generic.List<T>' requires 1 type arguments -