Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 04-06-2011, 10:16 AM   #1
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
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.

psftp -pw XXXXXX -l USERNAME@SERVER -P XXXX -b C:\Users\\ME\Desktop\ftp2.bat
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!
Old 04-06-2011, 09:53 PM   #2
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.10, Centos 7.5
Posts: 17,565

Rep: Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425Reputation: 2425
Sounds like a job for 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 ....


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 11:02 AM
ftp - mput help needed concoran Linux - Software 13 05-10-2008 12:33 AM
ftp with mput tijo.thomas Linux - Software 1 03-06-2006 12:42 AM
mput all in ftp snoble Linux - Software 0 11-02-2004 05:36 PM
smbclient mput quiet mode? jess_wundring Linux - General 1 10-29-2002 09:37 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:57 PM.

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