Copying a subset of files from a directory on CentOS

I had a huge number xml files (somewhere close to 100k files) and i needed to copy just a 1000 of them for a few tests on CentOS. I wasn’t interested in the order of the files, simply just any 1000 will do.

After trolling all over the internet, if found this simple solution.

 find $targetDir -maxdepth 1 -type f |head -1000|xargs cp -t $destDir

Where $targetDir was the path to the folder containing the large set of files, and $destDir is the folder in which i wanted to copy the 1000 files into.

Sweet and simple. Gleaned from here


Update on JDK 6 update 4 and NetBeans 6.0 on Fedora 8

It turns out the problem with NetbBeans 6.0 not rendering well when desktop effects are enabled in Fedora 8 has been solved at the JDK level. Just upgrade to JDK 6 update 4 from Sun. Now my NetBeans will enjoy being wobbled about.

Oh and i just discovered JavaDB (or more popularly Derby) is bundled with JDK 6. Didn’t quite notice its existence. And with the latest JDK it comes with documentation on how to use it in your apps. This is good for simple applications that need to bundle some small database to work with. Congrats to Sun.