Solved

ROboscript to move a file to another Servers Directory

Posted on 2016-11-11
10
71 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 69

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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

 

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 54

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 54

Accepted Solution

by:
Bill Prew earned 500 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 69

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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

This Windows batch file is useful for organizing image files from a digital camera or other source, but can have many other uses.  It simply renames the file(s) to match their create date.  For example, if you took a picture today at 1:40pm and the …
Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
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…

733 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