Renaming files in folders

HI,

Seeking some direction on how this can be coded

looking in the following paths then running the steps below, is this possible?

“C:\IBM\WINCOLLECT”
“C:\Program Files\IBM\WINCOLLECT”
"C:\Program Files (x86)\IBM\WINCOLLECT\

Stop the WinCollect service.
Go to the WinCollect LOGS folder*.
Rename WinCollect_System.LOG to WinCollect_System01.LOG.
Rename WinCollect_Code.LOG to WinCollect_Code01.LOG.
Go to the WinCollect CONFIG folder.
Rename Console.PEM to Console.OLD.
Restart the WinCollect service.
Thanks

Have you tried to do any of this?

If you can give it a shot we can help you when you run into issues but the problem is a little specific and abstract for someone to just provide the solution.

Give it a shot and let us know where you run into a problem!

This is what i come up with, does this make sense

exists folders "IBM\WINCOLLECT" of (it; folders "Program Files" of it; folders "Program Files (x86)") of folders "C:"

waithidden net stop 
"Wincollect" waithidden net stop

 copy "C:\IBM\Wincollect\Logs\WinCollect_System.LOG" "C:\IBM\Wincollect\Logs\WinCollect_System.OLD"

delete "C:\IBM\Wincollect\Logs\WinCollect_System.LOG"

copy "C:\IBM\Wincollect\Logs\WinCollect_Code.LOG" "C:\IBM\Wincollect\Logs\WinCollect_Code.OLD"

delete "C:\IBM\Wincollect\Logs\WinCollect_Code.LOG"


copy "C:\IBM\Wincollect\Config\Console.PEM" "C:\IBM\Wincollect\Config\Console.OLD"

delete "C:\IBM\Wincollect\Config\Console.PEM"

waithidden net start 
"Wincollect" waithidden net start

Hi Team,

Please try this script

parameter “filename” = “C:\test\Config.cfg”

move “{parameter “filename”}” “{parameter “filename”}.bak”

Suresh…

thanks for that, i am getting this though

Completed parameter “filename” = “C:\IBM\Wincollect\Config\Console.PEM”

Failed move “{parameter “filename”}” "{parameter “filename”}.bak"
parameter “filename” = "C:\IBM\Wincollect\logs\Wincollect_System.log"
move “{parameter “filename”}” "{parameter “filename”}.bak"
parameter “filename” = "C:\IBM\Wincollect\logs\Wincollect_Code.log"
move “{parameter “filename”}” “{parameter “filename”}.bak”

not sure if i am missing something

I assume you only need “1” copy of the files? If so, remember that if you try to create or move a file, and the file all ready exists… it will fail.

Example:
move “{parameter “filename”}” “{parameter “filename”}.bak”
– above WORKS the first time… yea…

Issue that again, and it will FAIL because “filename.bak” all ready exists from last time. So delete them first (if you use the delete command and the file is NOT there… it won’t fail).

1 Like