Welcome to Dream.In.Code
Become a C++ Expert!

Join 137,176 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,390 people online right now. Registration is fast and FREE... Join Now!




Copying Files from Hda to sda

 
Reply to this topicStart new topic

Copying Files from Hda to sda, Linux

homemade-jam
20 May, 2008 - 10:11 AM
Post #1

eeeAddict
Group Icon

Joined: 17 Mar, 2008
Posts: 1,067



Thanked: 1 times
Dream Kudos: 25
My Contributions
Hello,

Basically I want to write an app that copies some files from hda1 to sda1 that I can simply exec rather than having to manually go in and copy and paste...does anyone have a starting point from where I can go because I'm not really sure?

Jam
User is offlineProfile CardPM
+Quote Post

RobinV
RE: Copying Files From Hda To Sda
21 May, 2008 - 03:50 AM
Post #2

New D.I.C Head
*

Joined: 21 May, 2008
Posts: 13


My Contributions
What about execl? or System?
User is offlineProfile CardPM
+Quote Post

homemade-jam
RE: Copying Files From Hda To Sda
21 May, 2008 - 03:57 AM
Post #3

eeeAddict
Group Icon

Joined: 17 Mar, 2008
Posts: 1,067



Thanked: 1 times
Dream Kudos: 25
My Contributions
QUOTE(RobinV @ 21 May, 2008 - 04:50 AM) *

What about execl? or System?


as in something like system("foo"), can you run anyhting as you would from cmd as foo?
User is offlineProfile CardPM
+Quote Post

baavgai
RE: Copying Files From Hda To Sda
21 May, 2008 - 06:55 AM
Post #4

Dreaming Coder
Group Icon

Joined: 16 Oct, 2007
Posts: 2,046



Thanked: 106 times
Dream Kudos: 475
Expert In: C, C++, Java, C#, ASP.NET, PHP, Perl, Python, Oracle, SQL Server, MySql, HTML, JavaScript, Lua

My Contributions
Sounds like you're just looking for a batch file. You just make a text file with the copy commands you want to repeat. You put a "sheebang" notation at the top to tell it what interpreter to use.

Something like this ( plain vanilla shell ):
CODE

#!/bin/sh

cp -R /mnt/hda1/Documents/* /mnt/sda1/Documents
cp /mnt/hda1/bookmarks.html /mnt/sda1/


The file will need to be executable, so use this command "chmod u+x myfirstbat.sh". Then, when you need to run it, just type "./myfirstbat.sh" in a console and it should fire off.

Read more here: http://www.freeos.com/guides/lsst/

User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/4/08 10:53AM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month