?
Solved

ROboscript to move a file to another Servers Directory

Posted on 2016-11-11
10
Medium Priority
?
83 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
  • 2
  • +1
10 Comments
 

Expert Comment

by:Antonio Jr Sun (VCP5-DCV)
ID: 41884474
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 70

Expert Comment

by:Qlemo
ID: 41884643
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
ID: 41886533
Qlemo  it is just the preference of the IT director that we script using Robo
0
New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

 

Author Comment

by:Twhite0909
ID: 41886563
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 57

Expert Comment

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

~bp
0
 

Author Comment

by:Twhite0909
ID: 41886635
like this?

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

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 41886649
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
ID: 41886650
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
ID: 41886653
That worked Bill TYVM!!  TY all for your assistance much appreciatted
0
 
LVL 70

Expert Comment

by:Qlemo
ID: 41886659
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
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…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

764 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