Solved

ROboscript to move a file to another Servers Directory

Posted on 2016-11-11
10
30 Views
Last Modified: 2016-11-17
I need a robo script to move a file from this server's location to another.  We use Roboscript.  This is an FTP server and the file is sent to us everyday to the ftp directory.  I want to script the file to be moved to another servers directory everyday


File arrives:   \\sftp.company.com\customers\companya\file.txt

Move FIle to :  Server 01\customers\companya
0
Comment
Question by:Twhite0909
  • 5
  • 2
  • 2
  • +1
10 Comments
 

Expert Comment

by:Antonio Jr Sun (VCP5-DCV)
Comment Utility
Alternative solution. Hope this will help.

This simple can be done using powershell script save as .ps1 extension

for (;;) {
    move-item c:\source\* c:\destination
}
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
What is the exact issue? And why using RoboScript for something that simple?
I would just set up a scheduled task running once a day a regular (x)copy.
0
 

Author Comment

by:Twhite0909
Comment Utility
Qlemo  it is just the preference of the IT director that we script using Robo
0
 

Author Comment

by:Twhite0909
Comment Utility
Antonio I tried to write a .ps1 using your script but get errors.  Ive attached a copy of the script text file.  It errors and states" Move-Item : A positional parameter cannot be found that accepts argument"
movefilescript.jpg
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
Since you have spaces in the pathnames you will need to enclose them in double quotes.

~bp
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 

Author Comment

by:Twhite0909
Comment Utility
like this?

for (;;) {
    move-item D:\WS_FTP Server\sftp.companya.com\users\customer1\* "P:\Welcome Letters"
}
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
Comment Utility
Both paths, since the first has a space too, so:

move-item "D:\WS_FTP Server\sftp.companya.com\users\customer1\*" "P:\Welcome Letters"

Open in new window

~bp
0
 

Author Comment

by:Twhite0909
Comment Utility
so basically what Im trying to do here is have the script pull any and all files that exist in the source directory and dump them in the destination directory.  Sometimes it may be different file types .csv or .txt and sometimes the number of files will range from 1-200 so I need a script that looks in the source folder then grabs everything in there and movers it to the destination folder.  BAsed on that how can I make the below work.  

or (;;) {
    move-item D:\WS_FTP Server\sftp.companya.com\users\customer1\* "P:\Welcome Letters"
}



Also when I try it like this by putting double quotes on entire line  I see cmd execute 1,000 times but the file is never moved

or (;;) {
    "move-item D:\WS_FTP Server\sftp.companya.com\users\customer1\* P:\Welcome Letters"
}
0
 

Author Comment

by:Twhite0909
Comment Utility
That worked Bill TYVM!!  TY all for your assistance much appreciatted
0
 
LVL 68

Expert Comment

by:Qlemo
Comment Utility
But you never should do that endless loop stuff without at least an sleep! If you do not want to use a scheduled task, as I have recommended, run this:
while ($true)
{
  move-item 'D:\WS_FTP Server\sftp.companya.com\users\customer1\*' 'P:\Welcome Letters'
  sleep 86400
}

Open in new window

This runs the command once a day (86400 seconds). Switch to e.g. 3600 for an hourly move.

Side note: Single quotes are "literal string quotes", while double quotes allow for replacing variables and expressions inside the string. To be save, it is good practise to use single quotes whenever you do not want to have variable expansion inside the string happen.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now