LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-06-2011, 09:16 AM   #1
Mackenzie
LQ Newbie
 
Registered: Apr 2011
Posts: 1

Rep: Reputation: 0
SFTP Mput help!


Hello everyone, I am new here at the forums, but I have a little Linux background from college getting Linux + certified. Although I am certified, I got that certification when Fedora Core 4 was out and now it's way beyond that... plus I haven't used Linux much since I got out of college. Anyways enough about me.. here's what I've got.

I work at a hospital. The hospital has an outter office that reads x-rays from the hospital. We have these on a server here at the hospital (in folders named after the day 04.06.11) and we are going to be uploading them to a corporate server so the outter office can see them. We are using SFTP for this. Currently I am working in Windows, but I am using the putty program inside of command prompt, which uses Linux based commands.

Right now whenever a new x-ray comes through a person from our hospital puts the file into an archive folder on the server. We then run Xcopy to copy over the new files. Here is my xcopy command
Quote:
xCopy /d /s /e /m /y SERVERNAME\mesa\archive\*.* d:\mesa\
This copies the files from the folder archive to the d:\mesa folder.

Now what I've got are 2 scripts I've wrote to connect to the SFTP site and switch to the directory needed and copy files over.

FTP1.BAT
Quote:
psftp -pw XXXXXX -l USERNAME@SERVER -P XXXX -b C:\Users\\ME\Desktop\ftp2.bat
FTP2.BAT
Quote:
open "USERNAME@SERVER" XXXX
cd To_CCS/scans/
mput C:\mesa\archive\*.pdf
Now what I am wanting to do is something like Xcopy, but with the ftp site.

Is there ANY way to get it to where the mput or put command looks for only new files that are not already on the server? What's going on now is whenever I run this, it will copy all the files over again whether they are already there or not.. waisting time and bandwidth. I thought about running a script to compare the archive folder and regular mesa folder to a text file then copy those files over, but I can't seem to figure this out either.. although that would be a Windows batch file to do that I'd hope someone here could help me. I'd greatly appreciate any help offered, as this will make my job a lot easier so I can just schedule a task to do this and I can do other things.

Thanks in advance!
-Mackenzie
 
Old 04-06-2011, 08:53 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,358

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Sounds like a job for rsync http://linux.die.net/man/1/rsync, but I don't know how you'd talk to MS-Windows; you might need to install Cygwin (gives you a *nix cmd line/env inc tools) on the MS box.
Alternately why don't you create a txfr dir on your PC and download new files into that first, then copy them to Linux, then mv new files to archive dir (if I understand your description).

I'm sure someone else will coma long with a better idea soon ....
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
smbclient mput alphaniner Linux - Software 2 04-24-2009 10:02 AM
ftp - mput help needed concoran Linux - Software 13 05-09-2008 11:33 PM
ftp with mput tijo.thomas Linux - Software 1 03-05-2006 11:42 PM
mput all in ftp snoble Linux - Software 0 11-02-2004 04:36 PM
smbclient mput quiet mode? jess_wundring Linux - General 1 10-29-2002 08:37 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:41 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration