Linux Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsLinux Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 29th, 2009, 03:23 PM
glytology glytology is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 244 glytology User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 Days 4 h 38 m 54 sec
Reputation Power: 0
Question How can I move files to another directory using a cron job?

I am new into linux administration, I have a php script in cron directory that generates 5 textfiles, after the files are generated, I want to create a script that will move the 5 text fiels to anoher folder name "web".

Can someone kindly help me on this?

Thanks

Reply With Quote
  #2  
Old September 29th, 2009, 03:39 PM
tj_nt tj_nt is offline
Contributing User
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2004
Posts: 2,098 tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level)tj_nt User rank is General 12nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 3 Weeks 11 h 9 m 33 sec
Reputation Power: 1762
write a simple shell script that moves the files and have CRON execute the shell script

a shell script can be as simple as a single command or you can string commands together...

for instance you could use the following to move the files

shell script:
Code:
#!/bin/sh
mv /home/user/files /web


where "/home/user/files" is where the files are

and "/web" is where you want them to go

edit and save the script above...make sure its owner is the same as the CRON user and be sure that it is executable...then create a crontab to run the script whenever you want

Reply With Quote
  #3  
Old September 30th, 2009, 05:23 AM
ishnid's Avatar
ishnid ishnid is offline
kill 9, $$;
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: Sep 2001
Location: Dublin, Eire
Posts: 5,989 ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level)ishnid User rank is General 18th Grade (Above 100000 Reputation Level) 
Time spent in forums: 3 Months 3 Weeks 1 Day 22 h 11 m 20 sec
Reputation Power: 2212
Is there a particular reason your PHP script doesn't create the files in the desired location in the first place?

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsLinux Help > How can I move files to another directory using a cron job?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek