I have very little experience that’s why I need some help to get started I have been given a task to write a perl script in Linux and I don’t know from where to begin. Can anyone help me out with this please.

1. Move files from Windows 98 machine to this linux machine folders and sub-folders.
(I mean \\machine\c:\list\*.* to /var/www/list/) (\\machine\c:\lot_repos\*.* to /var/www/lot_repos/) & a long list is there.

2. Move the above files at a given hour of the day.

3. CHMOD this files to 644.

4. Generate a list of reports of those moved files.

As a newbie I swear that I don’t know about this from where to begin writing this script. Please some one help & save me.

Is This a homework project, or something for work, or something for yourself? This makes a difference in the approach that you will have to take in order to make some of the options work a specific way.

Hello,
I have already setup samba and both windows and linux are able to communicate.

This is NO homework project or something for myself? This is real work which I am facing in the office. They want this to be done immediately and i being a new to this is unable to do. Kindly rescue me from this as the main person who was handling all this has been fired and now i am on the fire?

Kindly some one help me. Please
Thanking you in advance.

The reason I said this, is because it's very possible to use what's called "CRON" to have the script run at certain times and/or certain dates. On your Unix Machine, Do A man on cron: man cron
It will give you a whole lot of information about setting up any script or program to run at a certain date and time.... I can help you with all the other things.... chmoding, and moving the files (I think....I'm not sure how you reference a samba partition, is just mounted in a folder?)....

Hello,
Thanks for your positive response to me. Today I have tried the cron (scheduled) in my system.
We have mounted samba partition in a folder.
Please can you help in writing the script that will do the job.
moving,chmod & a report.
Awaiting for the reply. Thank you in advance.
Bye

Ok, What Directory on the unix box is the windows share mounted on? (what is the unix path to the samba share)?

Thanks for helping me Comatose

[global]
workgroup = SCTHOME
server string = SCT Server
encrypt passwords = yes

[downloads]
path = /var/www/list

[sctdata]
path = /var/www/lot_repos

Once again thanks for giving me support.

Wait, I'm still confused..... this program needs to copy files from windows to linux.... ok good. Now, we have Samba setup. Samba lets us share a directory between windows and linux.... ok great... you have 2 shares....downloads and sctdata, and these two shares.... go to /var/www/list and /var/www/lot_repos respectively. So far still so good.... so, if the windows box or windows user copies files to the downloads or sctdata share.... I'm seeing them automagically show up in /var/www/list and /var/www/lot_repos.... right? So Samba is doing all the work so far.... it's even copying the files from windows to linux right? So, if not mistaken, the perl program has no need to do anything other than chmod files, and print a report right?

I have a similar situation. I download media files and encode movies on my windows box, then use a script to copy them over to my linux(freevo) video server. I am using bash, it seems to be the easiest. A 'for loop' would seem the easiest way to do it. This would be the general idea

#!/bin/bash

SAMBA=/path/to/samba/directory/to/share
DEST=/path/to/linux/destination/directory

for i in `ls $SAMBA` ; do cp $SAMBA/$i $DEST ; chmod  644 $DEST/$i ; done

or this might work

#!/bin/bash
SAMBA=/path/to/samba/directory/to/share
DEST=/path/to/linux/destination/directory

cp $SAMBA/* $DEST
chmod -R 644 $DEST

those are both over simplified, but with out more specifics. I don't really have any more to offer. Either of those scripts could be stuck in your /etc/cron.daily

To be honest When I placed that answer I thought I was answering his post that he left in th linux shell scripting forum(he posted in both areas). After making the post I realized it was in the perl section. I thought I amended the post to clear up my mistake, I must have just previewed it , but for got to make the changes final.

Hello Comatose & to everybody,

Ok Comatose i agree with you that i can see files in them, how to do chmod.
Will you please tell me how to do vice versa copy linux files (sub-folder) to windows.
Help will be highly appreciated.

This article has been dead for over six months. Start a new discussion instead.