LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-23-2012, 03:37 PM   #16
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286

Friends, sorry for my interruption, but are answers given above simple and problem oriented (I can see some scripts, that is well and good, but any script really needed here)?
User is obviously a newbie who is even not sure about how to move or catagorise the files properly. So I feel that we should have suggested something that is simple, and easy to understandable to him.

@Drigo, did you try any of solution provided above? If not then the answer is very simple - your task can be done using just three or four simple commands i.e. mv, mkdir, rm and little bit find command. So go through the commands and make a try with the esiest one solution you find! Good luck.
 
Old 10-23-2012, 03:45 PM   #17
JaseP
Senior Member
 
Registered: Jun 2002
Location: Eastern PA, USA
Distribution: K/Ubuntu 12.04/14.04, Scientific Linux 6.3/6.4, Android-x86, Pretty much all distros at one point...
Posts: 1,799

Rep: Reputation: 157Reputation: 157
His parameters were;
* Not a script
* executed in one line
* specific file structure, files, etc. to move (resembles an academic assignment)

Since the original question appeared to me to resemble a homework or lab assignment, I chose not to give him a direct answer. Instead, I chose to feed him information and sources so he can figure it out for himself... You know, "... teach a man to fish,..."?!?!

If it wasn't an assignment, I apologize for that,... But, it appears he's looking to expand his knowledge, not just get the result. So, either way,... helping him learn is better than feeding him an answer.
 
Old 10-23-2012, 04:06 PM   #18
Drigo
Member
 
Registered: Jun 2009
Posts: 111

Original Poster
Rep: Reputation: 17
Well...I will just create a general script for my usage with the responses suggested above.
@meninvenus I've posted other posts and people were very helpful with their responses. They helped me understand bash scripting and other functions that I wasn't aware of. These were the answers I was looking for. cp rm mv etc...are bvery straightforward and I know how to use them and I can create a script. I am a newbie looking to expand my knowledge (thanks for your words JaseP . Meninvenus....you are rude! And its a simple solution I know....but go to over 16k folders each with 5subfolders and many subfolder trees...well other than a script or a simply line code (which I was looking for) wont do the trick.
And btw this is not a homework assignment..lol

Thanks to all the other members who replied
 
Old 10-24-2012, 12:20 AM   #19
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Quote:
Thanks to all the other members who replied
@Drigo: Won't you say thanks to me also, as I had also answered (check my previous reply) .
Apart joking, I think there was nothing rude in my previous comment which you should mind at all! But perhaps I thought you need a simple solution.
So let me clear, why I preffered a simple solution.
First, you can move as many as files using a ./* from any location to any location.
Second, for knowledge gaining purpose it's ok to create a script, or try different solutions. But on the other hand, for sake of finished the task, I am again saying that the solution is just one or two commands away:
Code:
mkdir <new-dir>
mv ./* /path/to/<new-dir>
Or even,
Code:
find /path/to/files <search-pattern> -exec mv /path/to/<new-dir> {} \;
Third, a scrpt is pattern specific, whereas little manual work using cmds will avoid any mess up of large data in a little complicated file hierarchy.

Hope this will clear why I gone with a simple solution. Have good luck.
 
  


Reply


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
[SOLVED] How do I move files from within many subdirectories to another one? gauchao Slackware 10 06-25-2011 02:07 PM
[SOLVED] move all ".txt" files, adding parent directory to filename mostofmonty Linux - Newbie 9 09-15-2009 09:39 AM
Move files from several subdirectories one level back Marinus Programming 2 01-21-2007 06:59 PM
Run script on every file contained within a parent directory and its subdirectories General Programming 4 05-15-2006 03:12 AM
move files to a series of subdirectories acid2000 Linux - General 1 09-01-2003 06:44 PM


All times are GMT -5. The time now is 07:48 AM.

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