Save ME

Please support our Perl advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2005
Posts: 7
Reputation: anthony05 is an unknown quantity at this point 
Solved Threads: 0
anthony05 anthony05 is offline Offline
Newbie Poster

Save ME

 
0
  #1
Jun 7th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Save ME

 
0
  #2
Jun 7th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 7
Reputation: anthony05 is an unknown quantity at this point 
Solved Threads: 0
anthony05 anthony05 is offline Offline
Newbie Poster

Re: Save ME

 
0
  #3
Jun 7th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Save ME

 
0
  #4
Jun 7th, 2005
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?)....
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 7
Reputation: anthony05 is an unknown quantity at this point 
Solved Threads: 0
anthony05 anthony05 is offline Offline
Newbie Poster

Re: Save ME

 
0
  #5
Jun 8th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Save ME

 
0
  #6
Jun 8th, 2005
Ok, What Directory on the unix box is the windows share mounted on? (what is the unix path to the samba share)?
Reply With Quote Quick reply to this message  
Join Date: Jun 2005
Posts: 7
Reputation: anthony05 is an unknown quantity at this point 
Solved Threads: 0
anthony05 anthony05 is offline Offline
Newbie Poster

Re: Save ME

 
0
  #7
Jun 9th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Save ME

 
0
  #8
Jun 9th, 2005
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?
Reply With Quote Quick reply to this message  
Join Date: May 2005
Posts: 215
Reputation: shanenin is an unknown quantity at this point 
Solved Threads: 16
shanenin shanenin is offline Offline
Posting Whiz in Training

Re: Save ME

 
0
  #9
Jun 9th, 2005
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
  1. #!/bin/bash
  2.  
  3. SAMBA=/path/to/samba/directory/to/share
  4. DEST=/path/to/linux/destination/directory
  5.  
  6. for i in `ls $SAMBA` ; do cp $SAMBA/$i $DEST ; chmod 644 $DEST/$i ; done

or this might work

  1. #!/bin/bash
  2. SAMBA=/path/to/samba/directory/to/share
  3. DEST=/path/to/linux/destination/directory
  4.  
  5. cp $SAMBA/* $DEST
  6. 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
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 2,413
Reputation: Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough Comatose is a jewel in the rough 
Solved Threads: 211
Team Colleague
Comatose's Avatar
Comatose Comatose is offline Offline
Taboo Programmer

Re: Save ME

 
0
  #10
Jun 9th, 2005
Appreciate The Input, and you are correct, that would work..... not to be too much of a stickler though, this IS a Perl forum, and not a shell scripting forum. We have one of those here: http://www.daniweb.com/techtalkforums/forum113.html, that has a bunch of shell scripting posts.

Thank you.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 3224 | Replies: 11
Thread Tools Search this Thread



Tag cloud for Perl
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC