Solved

Script to download and move new files

Posted on 2013-02-03
12
876 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
ID: 38849961
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 38850051
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
ID: 38850087
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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
LVL 2

Author Comment

by:goraek
ID: 38850211
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
ID: 38853657
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
ID: 38856991
ok we r using winscp to download which is working but need a soluton to decrypt ill give robo a go.
0
 
LVL 2

Author Comment

by:goraek
ID: 39160158
We still havent beent able to do this.

Any one is able to help?
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 39160428
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
ID: 39199970
yeah, we have but its not doing what its supposed to do.
Any suggestion?
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 39200317
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
ID: 39239945
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
ID: 39240131
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
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…

822 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