01-22-2015 08:38 PM - edited 03-01-2019 09:12 AM
I tried to call a windows cmd of for loop like this:
for /f %a in ('dir \\server1\folder1 /b /o:-d') do copy \\server1\folder1\%a \\server2\folder2\ & exit
But the result is that Tidal won't execute the dir command within the for loop, but retrieve 'dir' as the return value of the first loop. Because the tidal job failed with output: cannot find \\server1\folder1\dir
Any thoughts?
01-23-2015 04:37 AM
Did you try enclosing the same command in a batch script and call the batch script from Tidal ?
You may also consider using PowerShell script to do the same task and see if it works
01-23-2015 07:14 AM
We are not allowed to run script on that server, but lony call cmd...
01-23-2015 08:20 AM
1. Does the Windows server have PowerShell installed ?
2. Look like you are trying to copy all the files in a directory to another. Do you really need a loop here ? Sorry if I am not reading the requirement correctly
3. Is robocopy installed on the agent Windows machine ?
01-23-2015 08:39 AM
1. Does the Windows server have PowerShell installed ?
Nope :-(
2. Look like you are trying to copy all the files in a directory to another. Do you really need a loop here ? Sorry if I am not reading the requirement correctly
No, I am only copying the newest file in the folder into the target folder, that's why I need a dir to list all files ordered by update time.
3. Is robocopy installed on the agent Windows machine ?
No :-(
01-23-2015 09:21 AM
Also, if you are using Windows Sever 2008, the PowerShell and robocopy should be available by default as part of the OS.
01-23-2015 10:32 AM
The following works for me. You can improvize to suit your need.
In the windows job you give
Command as : cmd.exe
Command Parameters : /c forfiles /p E:\Scripts /m *.* /c "cmd /c echo @file"
(this job will return all the files under e:\scripts)
01-23-2015 10:38 AM
Hi xuzhang01,
Please verify if agent is running under a domain service account or as local system. If local system then it will not be able to access network resources, and you will need to run under as domain service account with permissions to that network share.
BR,
Derrick Au
04-21-2015 03:17 PM
Test for access permissions on these servers 1st before you try and send something to them.
Too bad you don't try using PowerShell to attempt these activities, because PowerShell contains the Try, Catch Finally construct your job need in this example, just like C# and other languages, but it's a plain script file, like Perl.
The portion in this pic (attached) shows the construct of testing for access with the default credentials.
--
Remember,
-
That's ours,
We have a situation where we run (on the stack) at the top for data replication of files, but someone else owns the share and another maintains the actual server AND a different organization maintains the network and firewalls between the two servers.
=> Look at the total stack when you ask your questions and ask if you've addressed all the angles.
Also, a version of Microsoft PowerShell runs on every server Microsoft makes except Win2000 servers, but you'd better hurry and at least get up to Windows 2008R2 if you want support.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide