Script file to copy files

Dear all,
I have an external hard disk with lots of big files and a lot of small
matlab script files .m.

I would like to grab all the files inside that harddisk that have the
.m extension or the *.mat file extension (both are matlab files).

Of course this is a 
-first-find the *.m files script and 
-then copy the files into the hard disk.

What I  do not know is how I can also keep the structure of the folders
containing the *.m and *.mat files when I will copy them in my local
hard disk.

As this external hard disk contains 2TB of data it is not possible to
copy all the files first and then remove the unnecessary.
So I have to find and copy only the files I need but with also keeping
the tree structure that the external hard disk has .

Can you help me find out an easy way to do that?

Regards
Alex


-- 
alaios
------------------------------------------------------------------------



0
alaios
4/6/2011 12:36:01 PM
opensuse.org.help.applications 21533 articles. 1 followers. Follow

6 Replies
898 Views

Similar Articles

[PageSpeed] 52

Of course it should have been iin Programming/Scripting.  But I am not
moving it because of the wrath of the NTTP users (DD including).


-- 
Henk van Velden
------------------------------------------------------------------------
hcvv's Profile: http://forums.opensuse.org/member.php?userid=180
View this thread: http://forums.opensuse.org/showthread.php?t=457499

0
hcvv
4/6/2011 1:36:02 PM
I am sorry for that :(
what are the nttp users?


-- 
alaios
------------------------------------------------------------------------
alaios's Profile: http://forums.opensuse.org/member.php?userid=19093
View this thread: http://forums.opensuse.org/showthread.php?t=457499

0
alaios
4/6/2011 2:06:01 PM
This should get you started, I added echos so you can see what the
script will be doing.  Once you are happy with the script remove the
echos


Code:
--------------------
    
  cd /your/external/drive
  for FILE in $(find . -type f | grep -e ".m$\|.mat$")
  do
  THISDIR=`dirname ${FILE} | sed s/"^."//`
  echo "mkdir -p /local/drive${THISDIR}"
  echo "cp ${FILE} /local/drive${THISDIR}"
  done
  
--------------------


Good luck,
Hiatt


-- 
jthiatt08
------------------------------------------------------------------------
jthiatt08's Profile: http://forums.opensuse.org/member.php?userid=7949
View this thread: http://forums.opensuse.org/showthread.php?t=457499

0
jthiatt08
4/6/2011 2:06:01 PM
alaios;2319013 Wrote: 
> I am sorry for that :(
> what are the nttp users?

Never mind, I shouldn't have posted that here. My fault. The only thing
is that you are requested to post things about programming/scripting in
the correct sub-forum next time. The people who love solving problems
like yours are lurking there!


-- 
Henk van Velden
------------------------------------------------------------------------
hcvv's Profile: http://forums.opensuse.org/member.php?userid=180
View this thread: http://forums.opensuse.org/showthread.php?t=457499

0
hcvv
4/6/2011 3:06:01 PM
On 04/06/2011 05:06 PM, hcvv wrote:
>
>> what are the nttp users?
>
> Never mind

ok, i will answer him:

nntp users are those of a naturally superior intellect, extremely good 
looking, friendly demeanor and impeccable manner....like myself  ;-)

ok here is the truth: nntp is just a different method of accessing these 
forums...it is a much older method and unlike the web experience (with 
colors, and blinkies, and colored text etc etc) it is pretty 
plain...just plain text mostly...like non-html email..

some people find nntp a quicker way to ask or answer/help, others find 
it not only dull but far slower to use..

it is all in what you are used to..

unfortunately, some folks wanna generalize all nntp (or http) users to 
be cut from the same cloth.....which ain't the case because i heard 
someone say that they met an ugly nntp user---but, i don't believe it!!

;-)

by the way Alex, hcvv wasn't 'mad' at you, he was just giving me a hard 
time...in jest...and you misunderstood..

-- 
CAVEAT: http://is.gd/bpoMD [NNTP via openSUSE 11.3 + KDE4.5.5 + 
Thunderbird3.1.8] Can you believe it? This guy Ralph wins $181 million 
in the lottery last Wednesday, and then finds the love of his life just 
2 days later. Talk about LUCK!
0
DenverD
4/6/2011 4:19:28 PM
I know that he was not mad with me :)
Cheers!


-- 
alaios
------------------------------------------------------------------------
alaios's Profile: http://forums.opensuse.org/member.php?userid=19093
View this thread: http://forums.opensuse.org/showthread.php?t=457499

0
alaios
4/7/2011 11:36:02 AM
Reply:

Similar Artilces:

Integrating do I integrate all help files
How do I integrate PFC, sybase and powerbuilderhelp files together help such that I can get help on all issues (PFC, sybase and powerbuilderhelp ) through powerbuilder's help-content menu only . Please don't cross-post. On 1 Nov 2004 12:34:08 -0700, "Damola adesuyi" <someone@microsoft.com> wrote: >How do I integrate PFC, sybase and powerbuilderhelp files together help such >that I can get help on all issues (PFC, sybase and powerbuilderhelp ) >through powerbuilder's help-content menu only . > Bruce Armstrong [TeamSybase] http://www....

Help...copy file when the source file is open by another application
CopyFile does not work if the source is open. Please give me an example how to copy in that case the file from source to destination. Thanks. BB DD <> wrote: >CopyFile does not work if the source is open. Please give me an example how to copy in that case the file from source to destination. Thanks. Open the file in read-only mode. If the file cannot be opened in read-only mode, it can not be copied. Open the destination file. Read the source file. Write the destination file. Repeat until done. Close both files. ... ...

File.Copy and File.CopyTo DO NOT COPY CONTENTS OF FILE!@
I posted on here before but no one has been of any help. I am trying to copy files of type .zip .jpg and .pdf from ones folder to another (I dont want to move it, just make a copy). How can I do this? When I use File.Copy and File.CopyTo it makes a new file in the right folder but has no content and it also erases the content on the orignal file. WTF? This is really making me mad. Visit VistaForums.com #1 Windows Vista Forum Here you go --->  http://www.aspfaqs.com/aspfaqs/ShowFAQ.asp?FAQID=207Regards, Narayana Rao Surapaneni Architect | Author | MCSD for .NET | MCSD | SCJP ww...

file to file copy
--nextPart3236501.eDU2PhZZ46 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8Bit hello, i have to write a perl script which copies text from one file to another but only if the text is not exisiting yet. For example: in file1: word: moon word2: sky .... the same syntax for every line in file2: #some text word: honey word3: lol word4: mu .... as well the same syntax for every line so now i want to merge file1 into file2, so that word: honey will be replaced by word: moon and word2: sky will be appended to file2. i have written the following...

File::Copy::copy() dies on identical files?
I'm giving File::Copy's tests a bit of a face-lift and I came across this: eval { copy("copy-$$", "copy-$$") }; printf "ok %d\n", 15+$loopconst unless $@ =~ /are identical/ && -s "copy-$$"; which basically says, "copy() should die if given the same source and destination file" which is a little extreme. Warn perhaps, but not die. I think it's just parroting the behavior of the 'cp' shell command. If nobody has any objections, I'll downgrade that to a warning and copy() just succeeds. P...

File.Copy does not release the lock on the copied file.
 Hi! I am trying to use the File.Copy function in order to copy a file from the Client's PC to the Server. The File to be copied is selected by the user using the FileUpload control and is then used by the server to perform certain operations. My problem is that when I copy the file using the File.Copy method and then execute a streamreader process on the file straight after, I get the following error; "The process cannot access the file '\\syddev1\latest\xmasEmail.html' because it is being used by another process. " Below is the piece of code where the problem...

Copying more than one file using File::Copy
Good day=3B I apologize in advance if this is a very stupid question=85 I=27m trying to concatenate two files and have the results written to a = third file=2E = Maybe I=27m missing something obvious=2E=2E=2E but in Perldoc for File=3A= =3ACopy I = read=3A =22The copy function takes two parameters=3A a file to copy from = and = a file to copy to=2E=22 What can I do if I have a second file I want to copy from=3F (i=2Ee=2E Li= ke = DOS copy command=3A c=3A=5C file1=2Etxt + file2=2Etxt file3=2Etxt will co= py the = contents of file1=2Etxt =26 file2=2Etxt and put the...

to file:// or not to file://
(Firefox 1.5.0.6) I'm having trouble with HTML Anchors (links) using the file: protocol. The URL I'm trying to get at looks something like this file://///Host.Domain/Share/Dir1/Dir2/File.Ext If I click on the link, /nothing/ happens but, if I "Copy Link Location" and paste exactly the same thing into the "address bar" in FireFox, FireFox is perfectly happy to show me the file. Why the difference? Am I tripping over some security restriction here? Any suggestions? TIA, Phill W. Phill W. wrote: > (Firefox 1.5.0.6) > I'm ...

File Copy Script Help Needed
I want to copy a list of files from multiple directories which are subdirectories of one master directory, to just one location, all together in one directory. It should be simple enough, I just can't seem to figure it out! Copy <these files> from <Master directory (searching all subdirectories)> to <Destination Directory> I am not attempting to force the use of any particular command, just want to get the job done with the least hassle. At present the list of files is in a text file, one file per line. It would be nicer if those names could be au...

upload multi files, then attach file, then delete files help
Hi, I have a web form that needs do three things in one time when user click "submit" button. 1. upload multi files into web server (In know how to do this part) 2. send a email with these uploaded file to another user. 3. delete these uploaded files from web server. I know how to do 1). But, do not know 2) and 3). I know how to send email without attachment, But, once I add attachments. it does not work. Please help. Many thanks. Xiuxain Hi there, Please check the following links.. Sending Attachments and to delete file .. imports sys...

Javascript Application: It appears your menu dll file is out of sync with your script file.
I got this error messge after a clean install of dnn2.1.2. I got the site loaded correctly but when I log in I got "It appears your menu dll file is out of sync with your script file" and I couldn't do any admin work. When I mouse roll over the "admin" and "host" tab I got the same error message. I am using Access database for this DNN2.1.2 version. I had a DNN 3.0.9 installed with MSSQL database. They are all in the same local machine (win2k) And the 3.0.9 is running fine. ? Thanks. Copy the SolpartWebControls.dll located in 'controls\SolpartMenu\bi...

Error when copying using File.Copy and files exist
I'm trying to copy and overwrite files to an existing directory using :file.copy(source,destination,true)The command works perfectly when the files do not exist, but when trying to overwrite the files, I get an access denied error to the destination directory and files.It's not a permission issue because the folders have 'ASPNET' and 'Everyone' Access set up with full rights.Anyone have any ideas?Thanks in advance.JeffJeff Wasilauski, MCAD .NET, MCPC# WEB DEVELOPMENT-SQL SERVER DBA"If I have answered your question please mark as answer" Check if the File exists before copying and...

Problems with File.Copy() Method for copy big files
I´m using the follow commando to copy a file: source = "c:\\domains\\pagina.com.br\\wwwroot\\folder\\filesou.xml";target = "c:\\domains\\pagina.com.br\\wwwroot\\folder\\filetar.xmb"; File.Copy(source, target, true); If I used a small file (source) with for example 233000 bytes the server copy to target without problems. But if I used the file (source) with 700000 bytes the server don´t copy. I´ m copy to the same folder... Why is this happened with big file as source ? Thank you... Rogério Does it throw any error. HighOnCodingWanna get high! I don´t know if it throw any error.Ho...

copying a file without using module File::Copy
Hello All, Is the only way to copy a file from one directory to another by using the copy module...? Would anyone have a snipet of code copying a file from one dir to another... Any assistance would be appreciated... Thank you, Mike ------------------------------------------------ On Fri, 14 Feb 2003 10:13:06 -0500, Michael Pastore <Michael.Pastore@frontstep.com> wrote: > > Hello All, > > Is the only way to copy a file from one directory to another by using the > copy module...? > > Would anyone have a snipet of code copying a f...

Web resources about - Script file to copy files - opensuse.org.help.applications

Seal script - Wikipedia, the free encyclopedia
Seal script ( simplified Chinese : 篆书 ; traditional Chinese : 篆書 ; pinyin : zhuànshū ) is an ancient style of Chinese calligraphy . It evolved ...

Middletown review: Trite, pretentious and banal, Will Eno's script leaves little to love
Many an Australian playwright can do better than this &#8211; it's a shame one of them wasn't staged instead.

The cast of 'The Hateful Eight' tries to figure out who leaked the script on Jimmy Kimmel
... and Kimmel couldn't help but bring up the thing that almost derailed the entire movie from happening. While Tarantino was writing the script, ...

Express Scripts offers $1 alternative to $750 pill
After drug company's owner announced a 5,000-percent price hike earlier this year, a less expensive option will soon be available

Express Scripts partners with drug company to produce $1 version of Daraprim
Patients suffering from a rare parasitic disease will soon have a low-price alternative to Daraprim, the lifesaving drug sold by Turing Pharmaceuticals ...

Local Leaders Rewrite COP21 Script With Their Own Climate Change Pledges
... closer to conclusion, scores of local government leaders have come out swinging with strong climate goals Local Leaders Rewrite COP21 Script ...

Express Scripts To Offer $1 Version Of Drug That Skyrocketed To $750/Pill Overnight
... skyrocketed to around $750/pill, resulting in angry doctors , and a Senate investigation . Today, pharmacy benefits giant Express Scripts announced ...

Haven’t watched Steve Jobs yet? Read the script here
Based on the sadly dismal box office cash it’s failed to drum up, statistically few of you have seen Steve Jobs, Aaron Sorkin and Danny Boyle’s ...

David DiGilio To Script ‘The Stars My Destination’ Based On Sci-Fi Classic
... of Alfred Bester’s mindbending 1956 science fiction novel The Stars My Destination has a writer, with David DiGilio tapped to pen the script ...

Fallout 4 Script Extender has arrived, and with it the ability to make bigger mods for the game
... mods floating around. Sevral mods for Skyrim , New Vegas, Fallout 3, or Oblivion have required their versions of an add on called a Script ...

Resources last updated: 12/17/2015 4:11:44 PM