Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
1. Mount the Windows share on your Linux server and run your script in Linux
2. Run your script from Windows and SFTP to your Linux server
My past experience with Windows scripting is to avoid it whenever possible, so I tend to go for option 1 more than option 2. And if you already have the script written that does what you want in Linux, it shouldn't be very difficult to modify it for this purpose. You could also install an SFTP server on your Windows machine if you don't want to mount the folder directly in Linux.
I was looking at the option of installing the SFTP server on the Windows Box, I haven't done this before so just wanted to be sure what the best approach would be.
On the second part of my question, how would I get the script to check the age of the file on the Linux box and then to move it to the relevant folder on the windows box. These folders will be named Jan_2013, Feb_2013, Mar_2013, Apr_2013, etc. Without me having to update the script on the Linux box each month.
That depends a little on how you are determining age (created, accessed, modified), and whether you are copying all files or just the new ones. But in general you can use something like this, which looks at the modified date of the file and outputs the Mmm_YYYY based on modified date:
$ stat -c%Y your_file_here |xargs -I## date -d @## +%h_%Y
So if you had a for loop that ran through your directory hierarchy to look for files, you could use a command similar to above to populate a variable storing which directory each file should be copied to.
I'm having a problem connecting to the server. I have installed freeSSHd and tested a direct connection through putty. All of these work using the setup username and password. I am connecting through port 21. When trying to sftp username@servername:21 I get access denied on my password.
This is connecting from an Ubuntu Server to a Windows Server.
Last edited by SalientAnimal; 01-31-2013 at 01:55 AM.
Reason: Added detail