Author |
Message |
rhubman16
Joined: 08 Mar 2016 Posts: 41
|
|
Rename all files |
|
I need to get a list of all files in a directory and change the file extensions. What is the best way to do this in 24x7 script?
Thank you
|
|
Fri Apr 22, 2016 9:32 am |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7849
|
|
|
|
Do you need to apply any conditional IF...THEN logic or simply replace all files with a known extension to some other extension, for example *.txt to *.bak?
|
|
Fri Apr 22, 2016 9:43 am |
|
![](templates/GreenTech/images/spacer.gif) |
rhubman16
Joined: 08 Mar 2016 Posts: 41
|
|
|
|
I need to change all of the .csv files to .old. for all of those file types in 1 directory, no subdirs.
Thanks
|
|
Fri Apr 22, 2016 9:52 am |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7849
|
|
|
|
The simplest method is to run a DOS command
cmd /C rename *.csv *.old
|
|
Fri Apr 22, 2016 10:11 am |
|
![](templates/GreenTech/images/spacer.gif) |
rhubman16
Joined: 08 Mar 2016 Posts: 41
|
|
|
|
So I can just run a dos command somewhere in the JAL script? how would I do that?
I dont think I gave the full scope of what I am trying to do. during a script run, I need to rename the files.
|
|
Fri Apr 22, 2016 10:17 am |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7849
|
|
|
|
You can use RunAndWait JAL statement for that purpose
You can paste the syntax template using Paste JAL menu command in the editor.
|
|
Fri Apr 22, 2016 10:20 am |
|
![](templates/GreenTech/images/spacer.gif) |
rhubman16
Joined: 08 Mar 2016 Posts: 41
|
|
|
|
The CMD line method worked when I tested it with a local drive but I need to use a UNC path. It always fails. Any other suggestions?
|
|
Tue Apr 26, 2016 9:02 am |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7849
|
|
|
|
Have you "escaped" backslashes correctly?
\\\\computer\\drive\\whatever\\file.txt
|
|
Tue Apr 26, 2016 10:21 am |
|
![](templates/GreenTech/images/spacer.gif) |
rhubman16
Joined: 08 Mar 2016 Posts: 41
|
|
|
|
RunAndWait ( "cmd /C rename \\\\fileserver\\share\\f1\\f2\\f3\\*.csv \\\\fileserver\\share\\f1\\f2\\f3\\*.txt", "\\\\fileserver\\share\\f1\\f2\\f3" 60, renameid )
This is the command I am trying.
|
|
Tue Apr 26, 2016 10:30 am |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7849
|
|
|
|
What do you see in the job output files when you run that job. Are there any specific errors? Access denied?
|
|
Tue Apr 26, 2016 11:05 am |
|
![](templates/GreenTech/images/spacer.gif) |
rhubman16
Joined: 08 Mar 2016 Posts: 41
|
|
|
|
No I am not getting any errors in the log.
|
|
Tue Apr 26, 2016 11:14 am |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7849
|
|
|
|
I meant job output capture files, not log
I'm sure cmd.exe can start fine. But you need to see what it prints to the output
|
|
Tue Apr 26, 2016 11:27 am |
|
![](templates/GreenTech/images/spacer.gif) |
rhubman16
Joined: 08 Mar 2016 Posts: 41
|
|
|
|
Sorry, it the job output capture file, something I need to turn on? I have never used that before.
I really appreciate the help!!
|
|
Tue Apr 26, 2016 11:32 am |
|
![](templates/GreenTech/images/spacer.gif) |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7849
|
|
|
|
Hmm, your question makes me wonder if you are running 24x7 Multi-Platform edition or an old legacy version. In MP, that's a standard feature.
|
|
Tue Apr 26, 2016 11:37 am |
|
![](templates/GreenTech/images/spacer.gif) |
rhubman16
Joined: 08 Mar 2016 Posts: 41
|
|
|
|
It is an older version 3.4.26.
I am not able to upgrade to any current versions at this time.
|
|
Tue Apr 26, 2016 11:39 am |
|
![](templates/GreenTech/images/spacer.gif) |
|