Operating System - HP-UX
1832990 Members
2410 Online
110048 Solutions
New Discussion

Re: Pull files from Unix to Windows

 
SOLVED
Go to solution
JustMe76
Occasional Advisor

Pull files from Unix to Windows

I currently have a bat file which pulls files from windows server A to windows server B (the bat file resides on B). It does this using xcopy and it only pulls new or more recently modified files.

Well, windows server A is going away. We are moving to UNIX server Y. All the files that were on windows server A now live on Unix server Y and I need to modify my bat file to do the same thing it's always done, just using server Y instead of A.

I've looked at sftp (not sure about the 'login' parts in batch mode and I can't figure out how to only get the modified files).

I've looked at ftp...yeah, no idea how to connect to the UNIX server using ftp.

I've read about a million other things...but I'm totally stuck. I can't install anything on either of the servers.

Please help. I am NOT a person who uses Dos or UNIX commands with any regularity (I can stumble around in there...but not very efficiently). I've been working on this for 5 days now. It's becoming ridiculous.
12 REPLIES 12
Jeeshan
Honored Contributor

Re: Pull files from Unix to Windows

JustMe76
Occasional Advisor

Re: Pull files from Unix to Windows

Not sure what I am looking for in that link. Am I missing something? They recommend use of ftp, I can't get ftp from windows to unix to work.

If I ignore ftp and use sftp instead, that's fine, but it still doesn't address how to do it using windows authentication that the bat file automatically picks up. It also does not tell how to compare the source and desination files and only pull new or recently modified files.
Rita C Workman
Honored Contributor

Re: Pull files from Unix to Windows

JM76,

ftp is a basic command. Windoze can do it & UNIX has been doing it forever.

If you have an account on the UNIX box then do this to get familiar.

Get on Window box.
Get to dos command line
Type: ftp
Put in your UNIX login
Put in your UNIX password

cd to any directory you have access to
To put files FROM Windows to UNIX type:
put
To put several files FROM Win to UNIX type:
mput

To GET files just change the command from put to get
get

It is that simple...

I believe the thread you were pointed to was showing how you could script it and run it from Windows to automate getting the file(s)

Rgrds,
Rita
Steven Schweda
Honored Contributor

Re: Pull files from Unix to Windows

> [...] UNIX server Y [...]

Are you offering any clues as to the type of
"UNIX server" this might be?

> I can't get ftp from windows to unix to
> work.

Perhaps you did something wrong. My psychic
powers are too weak to tell you either what
you did, or what was wrong with it.

> I've been working on this for 5 days
> now. It's becoming ridiculous.

Sometimes it pays to hire someone who can
handle basic tasks.
JustMe76
Occasional Advisor

Re: Pull files from Unix to Windows

Okay..so, I CAN use ftp, but I need the Unix box IP address, right? I've been using sftp and specifying the server name and port (sftp -P 22 USERID@UNIXSERVER).


It needs to be a script, so that's all good. The password and username is still an issue...but I can try to figure a way around that...if no one has any ideas on it.

But what I'm really stuck on is how to use ftp to only pull all the files from the directory on the unix server that are new or have a more recent modified date to the directory on the windows server?

This is what we have for the two windows servers:
XCopy \\server1\myfolder\Load_Files\* d:\myfolder\Load_Files\* /D
Patrick Wallek
Honored Contributor
Solution

Re: Pull files from Unix to Windows

A better bet would be to have your Unix administrators install the CIFS Server product on the HP-UX box (NOTE: I am assuming HP-UX since this is an HP-UX forum). Then configure CIFS to share the directory on the Unix server via CIFS.

Once this is done, you can map the drive to your Windows server like any other shared drive. From there you should be able to use your xcopy without a problem.

It is going to be very difficult with FTP & SFTP to pull only newer files.

Info on CIFS Server product:
http://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B8725AA
JustMe76
Occasional Advisor

Re: Pull files from Unix to Windows

Sorry guys, after 5 days, apparently I'm becoming incredibly rude. I don't mean to be. I apologize. This is one of those scenarios where you're asked to step outside of your knowledge base.

I'm a programmer with 10 years of experience with Datastage (an ETL tool), .Net applications, Java applications, DBA work, COBOL programming, etc.

Unfortunately, it's been more 10 years since I've even SEEN a UNIX machine. Everybody has something aspect of development where they are weaker. I know some people who can barely spell SQL but blow me out of the water with their hardware knowledge and have many coworkers who are stars when it comes to ASP coding but don't ask them to look at anything Java...This is definately NOT my area of expertise. Again, I apologize for the tone of my posts above.
JustMe76
Occasional Advisor

Re: Pull files from Unix to Windows

"It is going to be very difficult with FTP & SFTP to pull only newer files."

Thank you. At least I know it's not possible and can stop searching for a way to make that happen. I was sure that it MUST be possible, which is why I've spent so long looking for the solution. :)

Guess I'll have to come up with a plan B.
Tim Nelson
Honored Contributor

Re: Pull files from Unix to Windows

>>>"It is going to be very difficult with FTP & SFTP to pull only newer files."

Yes the difficult part is determining "newer files" using ftp or sftp.

A couple notes:
1) if this was a unix script you could simple find /path -newer or find /path -mtime -2 etc..etc..
Can you do the same thing with NT scripting ? s/ftp to the server, pull a directory listing, parse that to find the files you want, then use that list to go get ?

2) sftp(scp) can be set up for trusted access. Exchange passwordless keys and now no need for manual password entry. Both can also be <
3) There is also an option to share the filesystem from unix to Windoze(or vise-versa) using CIFS. The files would then show as a share on Windoze (or vice-versa) and you could then use any native method you choose.

Million ways to skin a cat ..

Best of luck.


BTW, don't forget to thank everyone for their time by assigning points ( just pull down next to each respondant in this thread and pick a number, then click submit) It may benefit in the future ;)

JustMe76
Occasional Advisor

Re: Pull files from Unix to Windows

Thanks for the input. I feel like I have some direction now, as opposed to wandering rudderless through google search results. :-)

Appreciate all the help!
JustMe76
Occasional Advisor

Re: Pull files from Unix to Windows

Thanks for the input.
Dennis Handly
Acclaimed Contributor

Re: Pull files from Unix to Windows

>>It is going to be very difficult with FTP & SFTP to pull only newer files."

>At least I know it's not possible and can stop searching for a way to make that happen. I was sure that it MUST be possible

Sure it is possible but not easy. I.e. you will have to parse the "ls" output and then translate this into MS dates to do the compare.

Unfortunately, when you use ftp, the dates may change.