Can powershell do this?

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 3 months ago.

  • Author
    Posts
  • #5200

    by eyewon at 2012-10-16 10:19:04

    We need to change our mac environment to a Windows server and I need to know if I can do the following tasks automatically with Powershell.

    #1 – Check on an external ftp site to see if a file is available
    #2 – When the file is available, I need to download it and relocate it on the same server
    #3 – I need to open a share from another Windows server and copy the file to it
    #4 – I need to wait for the file to be transformed on the share and get the new file when it is transformed (Different filename)
    #5 – Copy to a OSX mac share (samba)
    #5 – Rename the file and place it to another ftp location.

    Can this be all automated without user intervention?

    If you need more details on the step, I can provide them with no problem.

    Thank you for your help everyone.

    by DonJ at 2012-10-17 08:29:12

    1. Not natively. You'd need to script up an FTP check yourself, or use something like /n software's NetCmdlets, which can talk to FTP.

    2. See #1.

    3. Sure.

    4. I'm not sure what you mean by "transformed." If there's some action being done to the file, you'd need some way to detect that. You could use a .NET Framework FileSystemWatcher to watch for a new file in that folder, I suppose, provided the file won't show up until it's done. If the file is created and then written to over a period of time, you'd likely have to keep checking it until it closes.

    5. Sure. Same as a Windows share. Technically CIFS or SMB, not Samba.

    5 again. Again, nothing native in PowerShell for FTP.

    I suspect you could do much of this in PowerShell by using the native http://ftp.exe, since http://ftp.exe actually accepts scripts. Check out its docs.

You must be logged in to reply to this topic.