You are not logged in.
Pages: 1
In shell, say I have a folder with 100 files, all very different filenames, and I want to move all of them except a few. How do I accomplish this rather quickly??
Offline
Copy a list of all the files to a single text file ('ls -1 > somefile.txt' - make sure you unset any aliases for ls, like the default arch .bashrc). Look at the text file and delete any lines with files you don't want to copy. Pass it to xargs ('cat somefile.txt | xargs mv wherever'). Get rid of the text file.
Last edited by fflarex (2008-10-19 05:37:26)
Offline
Use find to pick the ones you want. Check returned list for correctness, then rerun with moving. Or most file managers probably have a way to invert the selection, for example, pressing * in mc.
find . -not \( -name conklin-demo.mp3 -or -name con1.bmp \)
Last edited by pauldonnelly (2008-10-19 06:15:48)
Offline
Why not just mv the whole folder and then mv back the few individual files.
Offline
Why not just mv the whole folder and then mv back the few individual files.
People like to complicate the hell out of everything
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
Hehe, nah it's just the files are very large and oodles of them, plus they're on crappy old IDE drives.
Thanks for the help dudes
Offline
What I find helpful is something like this:
cd over-here
mkdir somedir
mv file1 file2 file3 somedir
mv * somewhere-else
cd somewhere-else/somedir
mv * over-here
cd ..
rmdir somedir
A bit involved, but it works
-dav7
Windows was made for looking at success from a distance through a wall of oversimplicity. Linux removes the wall, so you can just walk up to success and make it your own.
--
Reinventing the wheel is fun. You get to redefine pi.
Offline
In zsh you'd do something like that:
mv ^(a|b|c) /destination_dir
(that'd move everything from the dir except a, b and c)
Last edited by lucke (2008-10-19 08:06:41)
Offline
Hehe, nah it's just the files are very large and oodles of them, plus they're on crappy old IDE drives.
Thanks for the help dudes
Well, in these situations you can't avoid a dual-pane file manager. Like midnight commander.
The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...
Offline
Pages: 1