YOMAMA Suspended 6218 Posts user info edit post |
I have got about 30-40 folders that have about 10-15 files each inside. I want to remove all of the files from these folders and put them in one folder so all the files are in once place - no sub folders.
Anyone have an idea on how to do this? It’s a Linux box so I am not quite sure if I need to use CP or MV - I would rather use MV since I do not have the disk space to copy. 8/27/2008 2:50:43 PM |
synapse play so hard 60939 Posts user info edit post |
it'd be a pretty quick affair in windows...no idea about linux though 8/27/2008 2:55:38 PM |
YOMAMA Suspended 6218 Posts user info edit post |
8/27/2008 3:03:12 PM |
gs7 All American 2354 Posts user info edit post |
Assuming your directory looks something like:
dir0 | |---dir01 | |---dir011 | |---dir02 | etc
And assuming you have files in all those sub directories that you want moved into a new directory, run this:
find dir0 -type f -exec mv {} /new/directory \;
Make sense?
[Edited on August 27, 2008 at 3:06 PM. Reason : .]8/27/2008 3:06:12 PM |
joe17669 All American 22728 Posts user info edit post |
Quote : | "it'd be a pretty quick affair in windows...no idea about linux though" |
What's the quick way of doing it in Windows?8/27/2008 3:10:31 PM |
gs7 All American 2354 Posts user info edit post |
^I'd like to know that too ... Windows is ridiculously underpowered compared to a unix-based OS. (Note: I am not talking about 3rd-party software packages here) 8/27/2008 3:12:54 PM |
YOMAMA Suspended 6218 Posts user info edit post |
ok I am trying now - 8/27/2008 3:17:11 PM |
dFshadow All American 9507 Posts user info edit post |
in windows it'd just be a search for *.*
folders are sorted at the top of the list so just select the files and cut and paste to their new location 8/27/2008 3:19:33 PM |
YOMAMA Suspended 6218 Posts user info edit post |
Thank you - worked perfectly 8/27/2008 3:25:01 PM |
Shaggy All American 17820 Posts user info edit post |
in a dos batch script it would be something like
basedir=c:\base (or get this from input)
:parsedir for everything in the dir
if thing is dir cd dir goto parsedir
if thing is file move file to basedir
set currentdir=current directory
if currentdir ! basedir cd .. rmdir currentdir
Essentially you go through all the files in the basedir until you find a directory. If you find a dir you switch into it and call the function again. So you recurse through the directories, move the files you find, and then once you back out of a dir you remove it. Unless you're at the basedir in which case you do nothing 8/27/2008 3:25:44 PM |
synapse play so hard 60939 Posts user info edit post |
Quote : | "in windows it'd just be a search for *.*
folders are sorted at the top of the list so just select the files and cut and paste to their new location
" |
exactly8/27/2008 3:27:46 PM |
gs7 All American 2354 Posts user info edit post |
^^^You're welcome.
And while I see what you guys are saying to do it in Windows, I can't help but think how horrible of solutions those are versus a one line shell command
[Edited on August 27, 2008 at 3:29 PM. Reason : .] 8/27/2008 3:28:53 PM |
Prospero All American 11662 Posts user info edit post |
select, drag & drop is SO horrible
just remember why linux will never become a mainstream OS, it's because of "one line shell commands" that people need to know just to work the OS 8/27/2008 3:45:16 PM |
Aficionado Suspended 22518 Posts user info edit post |
or this person could just drag and drop with gnome or kde 8/27/2008 3:52:28 PM |
synapse play so hard 60939 Posts user info edit post |
Quote : | "just remember why linux will never become a mainstream OS, it's because of "one line shell commands" that people need to know just to work the OS" |
exactly. i don't wanna have to write a script to move some files around.
crap i need to lookup this command of course i screwed up the syntax ooh what options does that command need aaww damnit the syntax is still screwed up
that sounds like fun 8/27/2008 3:59:52 PM |
moron All American 34142 Posts user info edit post |
^ the problem is not the command line stuff, that's a benefit.
The problem is that there's no unified GUI, and if you don't know what gui someone has, you can tell them how to do what they want in that GUI.
It's just easier to spit out a command line command that works on all the nixes. 8/27/2008 4:01:28 PM |
gs7 All American 2354 Posts user info edit post |
So which method is faster when you have hundreds of subdirectories and thousands of files?
Drag and drop is not it. 8/27/2008 4:12:53 PM |
dFshadow All American 9507 Posts user info edit post |
Quote : | "So which method is faster when you have hundreds of subdirectories and thousands of files?
Drag and drop is not it." |
it's still going to take the computer the same amount of time to move the same amount of data. the GUI just makes it easier for me to give the computer that command(s).
your argument on the basis of speed doesn't really hold much ground.8/27/2008 4:25:07 PM |
synapse play so hard 60939 Posts user info edit post |
not to mention the OP doesn't have that many folders and files
and yeah, i'd still prefer to drag and drop 8/27/2008 4:26:16 PM |
gs7 All American 2354 Posts user info edit post |
8/27/2008 4:32:37 PM |