• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 908
  • Last Modified:

Script to download and move new files

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
goraek
Asked:
goraek
1 Solution
 
deviprasadgCommented:
0
 
Steve KnightIT ConsultancyCommented:
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
 
footechCommented:
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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 
goraekAuthor Commented:
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
 
AlexPaceCommented:
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
 
goraekAuthor Commented:
ok we r using winscp to download which is working but need a soluton to decrypt ill give robo a go.
0
 
goraekAuthor Commented:
We still havent beent able to do this.

Any one is able to help?
0
 
Steve KnightIT ConsultancyCommented:
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
 
goraekAuthor Commented:
yeah, we have but its not doing what its supposed to do.
Any suggestion?
0
 
Steve KnightIT ConsultancyCommented:
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
 
goraekAuthor Commented:
I'ved used robo-ftp, it looks ok as this stage. Had to mess about with it, but its all ok.
0
 
Steve KnightIT ConsultancyCommented:
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

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now