Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 10-30-2006, 08:31 AM   #1
al bernier
LQ Newbie
Registered: Oct 2006
Posts: 1

Rep: Reputation: 0
To create a batch file to use with a mem stick

I am using Linux bootable OS CD to retrieve file from a HD with an OS of Win 2K. The OS has become corrupt and I need to recover a file and save it to a memory stick. I want to create a batch file that anyone can execute from the Mem stick and in the batch file tell it where the file is and the file name and then copy to mem stick, without needing to use the Linux desktop and mouse.

Can anyone help me out.
Thanks AL
Old 10-30-2006, 10:09 AM   #2
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594Reputation: 3594
I want to create a batch file
Do you have any script writing experience? Have you done any work on this one? Maybe pseudo code? "Recover" as in using like Foremost, or "recover" as in plain copying a file? Are the drives automounted? Should the script check for inaccessable and unmountable partitions as well? Do the files reside in one directory, or should it locate files as well? Should it check if there's enough space on the stick? Compress copied files? And what is the name of the "Linux bootable OS CD"?
Old 10-30-2006, 10:33 AM   #3
LQ Newbie
Registered: Oct 2006
Location: UK
Distribution: MacOS , Redhat
Posts: 17

Rep: Reputation: 0
I am sure that it is possible in theory...

You need to know the following:

(a) The partition layout on the HDD in question and the type of file system that Win 2K is installed on.

(b) If the Boot/Recover CD has drivers for the USB hub (UHCI, OHCI, or EHCI) and filesystem in (a).

You need to create a temporary folder so that you can mount the
partition (that the OS is installed on) to it.

Also, create another temporary folder so you can mount the USB stick to it.

You need to 'dmesg' to find out if the correct modules are loaded for the USB stick, and to find the partition on the stick - usually only one and something like /dev/sdb1 - it depends on the USB slot and if anything else is plugged in to one of them.

Once this is done, then just mount the HDD partition, and the stick to their temp folders, then 'cd' into the correct folder on the HDD and 'cp' the file in question to the temp folder for the USB stick.

Hope this helps.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create batch file? TigerLinux Linux - Newbie 16 09-26-2011 12:24 PM
How to create a batch file? Franziss Programming 8 05-16-2005 12:36 AM
bizarre error when adding a new mem stick fenderman11111 Linux - General 3 07-05-2004 06:06 PM
Dns + Apache + Mem Stick borris9 Linux - Newbie 1 01-10-2004 10:07 PM
Red Hat 8.0 how-to use USB mem-stick donovan Linux - Newbie 2 06-22-2003 02:09 PM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:41 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration