Solved

Script to download and move new files

Posted on 2013-02-03
12
865 Views
Last Modified: 2013-06-11
Hi Guys,

I'm trying to script to download only new files  (by date if possible), and move it to a folder.

Or if there are other alternatives, we have WINSCP setup to poll files with GPG2 decryption. The filename contains the date eg filename_ddmmyyyy.csv.

We want to automate the polling from an external server, and then decrypt the file.

Is there an easier way of doing this?

Thanks,
Goraek
0
Comment
Question by:goraek
12 Comments
 
LVL 10

Expert Comment

by:deviprasadg
Comment Utility
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
How are the files accessible,  through windows drive mapping or ftp for instance?  do the files always stay there and you just want the one that has todays date in name, or ones modified today?  if the files do stay there, could they move into an archive directory after they are copied, then you just need all files from the dir of course?

will look back later when not on phone.

steve
0
 
LVL 39

Expert Comment

by:footech
Comment Utility
Some more detail on what the criteria for "new" files is would be helpful.  Should the source folder be monitored continuously, or do you just want something you can run once a day, once a week, or what?

Depending on access method, one way you could do some realtime monitoring would be to use Robocopy with the /MON (or even /MOT) switch, and /MOV would move files.  See the built in help for more detail.
0
 
LVL 2

Author Comment

by:goraek
Comment Utility
The downloaded files will be stored on a network drive.

I need them to be downloaded and decrypted, and users able to access the decrypted file.

Added: And be able to download and decrypt new ones, and not overwriting them.
0
 
LVL 16

Accepted Solution

by:
AlexPace earned 500 total points
Comment Utility
Can you delete or move the remote source files after downloading them?  If so you could assume that any file that exists must be unprocessed.

If you can't mess with the source files you could use Robo-FTP for the automation.  It has a built-in feature for saving a copy of the remote server's file structure in a database.  Then later when you connect it can compare the current state of the remote file structure with the state stored in the database and report any differences like new files, removed file and files with different sizes or last modified date.   Here is a sample Robo-FTP script that downloads only the new files: http://kb.robo-ftp.com/script_library/show/48

Robo-FTP also has built-in PGP commands.  Here is a sample for decrypting downloaded files: http://kb.robo-ftp.com/script_library/show/7

I suspect you could combine elements of those two samples to meet your project requirements.  This would be easier than your current solution but it uses a commercial program instead of shareware.
0
 
LVL 2

Author Comment

by:goraek
Comment Utility
ok we r using winscp to download which is working but need a soluton to decrypt ill give robo a go.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 2

Author Comment

by:goraek
Comment Utility
We still havent beent able to do this.

Any one is able to help?
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
I think there were some key questions unanswered?

1. can we write to source server, i.e. can we move / delete / rename the files when they have been downloaded.  then anything left is the ones you need.

Or have you got the downloading scripted now already?
0
 
LVL 2

Author Comment

by:goraek
Comment Utility
yeah, we have but its not doing what its supposed to do.
Any suggestion?
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
show us what you have got already....
give us the occasional hint based on questions asked - how is it accessible, can files, dirs be renamed, deleted after downloaded, moved to different dir etc.
0
 
LVL 2

Author Closing Comment

by:goraek
Comment Utility
I'ved used robo-ftp, it looks ok as this stage. Had to mess about with it, but its all ok.
0
 
LVL 43

Expert Comment

by:Steve Knight
Comment Utility
for future reference, if you want a script give us some info, and what you have so far.... no info = we don't know what you need so no-one chips in with their ideas to help....
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This article shows how a content item can be identified directly or through translation of a navigation type. It then shows how this information can be used to create a menu for further navigation.
Microsoft Windows Server Update Service (WSUS) is free for everyone, but it lacks of some desirable features like send an e-mail to the administrator with the status of all computers on the WSUS server. This article is based on my PowerShell script …
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now